windows应用开发由浅入深(三)有关不规则窗口

相关类:

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);
}








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值