win32繪製視窗

2021-10-20 10:46:09 字數 1371 閱讀 2844

; static int cxclient, cyclient; /*宣告兩個變數存放滑鼠 x,y 座標.在下面,我們為這兩項賦值時,loword(lparam)代表取 lparam 的低 16 位,hiword(lparam)代表取lparam 的高 16 位,在 lparam 中存放的實際就是滑鼠的位置,低 16 位為 x 座標,高 16 位為滑鼠 y座標.*/

hdc hdc;

int i;

paintstruct ps;

point apt[10];

switch (umsg)

setpolyfillmode(hdc, alternate);

polygon(hdc, apt, 10);

for (i = 0; i < 10; i++)

setpolyfillmode(hdc, winding);

//填充

polygon(hdc, apt, 10);

endpaint(hwnd, &ps);

return 0;

case wm_destroy:

postquitmessage(0);

return 0;

} return defwindowproc(hwnd, umsg, wparam, lparam);

}int apientry _twinmain(_in_ hinstance hinstance, _in_opt_ hinstance hpreinstance,

_in_ lptstr lpcmdline, _in_ int nshowcmd)

//建立視窗

cw_usedefault, cw_usedefault, null, null, hinstance, null);//顯示更新視窗

showwindow(hwnd, nshowcmd);

updatewindow(hwnd); //訊息迴圈中進行訊息處理

while (getmessage(&msg, null, 0, 0))

return msg.wparam;

}

win32 視窗繪製直線

在win32 視窗 繪製直線 測試環境 win7 64 位 vs2013 建立乙個 win32 應用程式 空專案,名稱是 hellopaintline,在專案中新增原始檔 hellopaintline.cpp 內容如下 include include include include lresult ...

在win32 視窗 繪製紅色直線

在win32 視窗 繪製紅色直線 測試環境 win7 64 位 vs2013 建立乙個 win32 應用程式 空專案,名稱是 hellopaintredline,在專案中新增原始檔 hellopaintredline.cpp 內容如下 include include include include ...

win32 視窗 繪製紅色填充矩形

win32 視窗 繪製紅色填充矩形 測試環境 win7 64 位 vs2013 建立乙個 win32 應用程式 空專案,名稱是 hellopaintfillrect,在專案中新增原始檔 hellopaintfillrect.cpp 內容如下 include include include inclu...