// Листинг 1.12. Графические построения с использованием путей POINT pt[5] = { {0,100}, {-59,-81}, {95,31}, {-95,31}, {59,-81} }; const int WIDTH = 400; const int HEIGHT = 300; LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC hdc; static int sx, sy; static HBRUSH hBrush; HRGN hRgn; switch (message) { case WM_CREATE: hBrush = CreateSolidBrush(RGB(255, 0, 0)); break; case WM_SIZE: sx = LOWORD(lParam); sy = HIWORD(lParam); break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); SetMapMode(hdc, MM_ANISOTROPIC); SetWindowExtEx(hdc, WIDTH, -HEIGHT , NULL); SetViewportExtEx(hdc, sx, sy, NULL); SetViewportOrgEx(hdc, sx/2, sy/2, NULL); BeginPath(hdc); Polyline(hdc, pt, 5); CloseFigure(hdc); EndPath(hdc); SelectObject(hdc, hBrush); SetPolyFillMode(hdc, WINDING); FillPath(hdc); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }