void CDlg::InitUI()
{
CRect rect, rectTemp, rectItem;
CRgn rgnTemp;
GetClientRect(rect);
m_rgn.CreateRoundRectRgn(0, 0,rect.Width(),rect.Height(), 20, 20);
m_rgnFrame.CreateRoundRectRgn(0, 0,rect.Width(),rect.Height(), 20, 20);
rgnTemp.CreateRoundRectRgn(1, 1,rect.Width() - 1,rect.Height() - 1, 20, 20);
m_rgnFrame.CombineRgn(&m_rgn, &rgnTemp, RGN_XOR);
rgnTemp.DeleteObject();
::SetWindowRgn(GetSafeHwnd(),(HRGN)m_rgn, TRUE);
}
.....
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
virtual BOOL OnInitDialog();
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
......
LRESULT CDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT lrst=CDialog::DefWindowProc(message, wParam, lParam);
if (!::IsWindow(m_hWnd))
return lrst;
if (message==WM_MOVE||message==WM_PAINT||message==WM_NCPAINT||message==WM_NCACTIVATE ||message == WM_NOTIFY)
{
CDC* pWinDC = GetWindowDC();
if (pWinDC)
{
CBrush brush;
brush.CreateSolidBrush(RGB(0, 0, 0));
pWinDC->FillRgn(&m_rgnFrame, &brush);
ReleaseDC(pWinDC);
}
}
return lrst;
}