1.创建一个基于对话框的应用程序;
2.打开CellipseInterfaceDlg类中OnInitDialog()函数:
添加代码
BOOL CTranspareDlgDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
.
.
.
//TODO: 在此添加额外的初始化代码
CRect Rect;//旧的当前窗体对象
CRgn newRgn;//新的窗体对象
//获取当前窗体区域
GetClientRect(&Rect);
//设置椭圆形窗体区域 CreateEllipticRgn创建一个椭圆形的区域
newRgn.CreateEllipticRgn(0,0,Rect.Width(),Rect.Height());
::SetWindowRgn(this->m_hWnd,(HRGN)newRgn,true);
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
程序运行结果:
