In order to achieve the round corner of the dialog window, here the main use of two functions,
CreateRoundRectRgn, and SetWindowRgn.
The program first obtains the window rectangle through the GETWINDOWRGN function, then creates a rounded rectangle through the CREATEROUNDRECTRGN function, and finally changes the window shape through the SETWINDOWRGN function.
Here's how:
1 Open "Class View", right click "CMyDlg", a menu appears, select "AddWindow Message Handler ..."
After 2, in "New Windows messages\events", double-click "OnSize", "OK"
The 3 editing functions are as follows:
void Cmydlg::onsize (UINT nType, int cx, int cy) {cdialog::onsize (NType, CX, CY);//Todo:add your message handler code here CRGN M_rgn; CRect RC; GetWindowRect (&RC); rc-=rc. TopLeft (); M_rgn. CreateRoundRectRgn (rc.left,rc.top,rc.right,rc.bottom,100,100); SetWindowRgn (m_rgn,true);}
The other windows are basically the same operation, follow this action
The results of the operation are as follows:
VC Creating rounded corners form 2