You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
58 lines
1.3 KiB
#include <windows.h>
|
|
|
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|
PWSTR lpCmdLine, int nCmdShow) {
|
|
|
|
MSG msg;
|
|
WNDCLASSW wc = {0};
|
|
|
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
|
wc.lpszClassName = L"BezierCurve";
|
|
wc.hInstance = hInstance;
|
|
wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
|
|
wc.lpfnWndProc = WndProc;
|
|
wc.hCursor = LoadCursor(0, IDC_ARROW);
|
|
|
|
RegisterClassW(&wc);
|
|
CreateWindowW(wc.lpszClassName, L"Beziér curve",
|
|
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
|
100, 100, 500, 200, NULL, NULL, hInstance, NULL);
|
|
|
|
while (GetMessage(&msg, NULL, 0, 0)) {
|
|
|
|
TranslateMessage(&msg);
|
|
DispatchMessage(&msg);
|
|
}
|
|
|
|
return (int) msg.wParam;
|
|
}
|
|
|
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
|
|
WPARAM wParam, LPARAM lParam) {
|
|
|
|
HDC hdc;
|
|
PAINTSTRUCT ps;
|
|
|
|
POINT points[4] = { 20, 40, 320, 200, 330, 110, 450, 40 };
|
|
|
|
switch(msg) {
|
|
|
|
case WM_PAINT:
|
|
|
|
hdc = BeginPaint(hwnd, &ps);
|
|
|
|
PolyBezier(hdc, points, 4);
|
|
|
|
EndPaint(hwnd, &ps);
|
|
break;
|
|
|
|
case WM_DESTROY:
|
|
|
|
PostQuitMessage(0);
|
|
return 0;
|
|
}
|
|
|
|
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
|
}
|
|
|