windows编程位图问题 20
LRESULTCALLBACKwinproc(HWNDhwnd,UINTuMsg,WPARAMwparam,LPARAMlparam){HDChdc,hdc1;PAINT...
LRESULT CALLBACK winproc(HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam){ HDC hdc,hdc1; PAINTSTRUCT ps; static HBITMAP hbitmap; HINSTANCE hinstance; static int x=0, y=0; BITMAP bitmap; TCHAR str[100]; switch (uMsg){ case WM_CREATE: hinstance = ((LPCREATESTRUCTA)lparam)->hInstance; hbitmap = LoadBitmap(hinstance, TEXT("图片")); GetObject(hbitmap, sizeof(BITMAP), &bitmap); x = bitmap.bmWidth; y = bitmap.bmHeight; wsprintf(str, TEXT("%d,%d"), x, y); MessageBox(NULL, str, str, 0); return 0; case WM_DESTROY: DeleteObject(hbitmap); PostQuitMessage(0); return 0; case WM_PAINT: hdc = BeginPaint(hwnd, &ps); hdc1 = CreateCompatibleDC(hdc); SelectObject(hdc1, hbitmap); BitBlt(hdc, 0, 0, 500, 500, hdc1, 0, 0, SRCCOPY); DeleteDC(hdc1); EndPaint(hwnd, &ps); return 0; default: break; } return DefWindowProc(hwnd, uMsg, wparam, lparam);}
效果:
资源: 展开
效果:
资源: 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏20(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询