|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- HDC hdc;
- PAINTSTRUCT ps;
- static int cxClient, cyClient;
- int iMapMode;
- switch (message)
- {
- case WM_SIZE:
- cxClient = LOWORD(lParam);
- cyClient = HIWORD(lParam);
- return 0;
- case WM_PAINT:
- hdc = BeginPaint(hwnd, &ps);
- iMapMode = GetMapMode(hdc);//取得当前的映射模式
- SetMapMode(hdc, MM_ANISOTROPIC);
- SetWindowExtEx(hdc, 100, 100, NULL);
- SetViewportExtEx(hdc, cxClient / 2, -cyClient / 2, NULL);
- SetViewportOrgEx(hdc, cxClient / 2, -cyClient / 2, NULL);
- Rectangle(hdc, -100, -100, 100, 100);
- Ellipse(hdc, -80, -80, 80, 80);
-
- SetMapMode(hdc, iMapMode);//还回映射模式
-
- EndPaint(hwnd, &ps);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
复制代码 |
|