相关类:
1、CRgn:Encapsulates a Windows graphics device interface (GDI) region.即、CRgn表示一个GDI封装区
MSDN描述:
A region is an elliptical or polygonal area within a window. To use regions, you use the member functions of class CRgn with the clipping functions defined as members of class CDC.
封装区是窗口的椭圆区域或者不规则区域。对封装区的所有操作,是通过CRgn的成员方法实现的,而CRgn是通过CDC类定义的裁剪方法得到的。
The member functions of CRgn create, alter, and retrieve information about the region object for which they are called.
CRgn的成员方法可创建、修改封装区,并可以检索封装区对象信息。
2、CRect:A CRect contains member variables that define the top-left and bottom-right points of a rectangle.这是用左上点坐标和右下点坐标表示的矩形工作区
相关函数:
1、GetWindowRect(): 获取表示矩形工作区区域的的CRect类。
2、CRgn.CreateRoundRectRgn(): Creates a rectangular region with rounded corners that is stored in the CRgn object.
创建圆角矩形封装区,参数是圆角的信息,存储进CRgn实例中。
3、SetWindowRgn(); Sets the window region of a window. 设置窗口的封装区域。
void CmainDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
CRect cRect;
CRgn cRgn;
GetWindowRect(&cRect);
cRect -= cRect.TopLeft();
cRgn.CreateRoundRectRgn(cRect.left,cRect.top,cRect.right,cRect.bottom,150,150);
SetWindowRgn(cRgn,TRUE);
}