1,怎么创建圆形窗口
在对话框类中的OnInitDialog()函数中添加
CRect rect;
GetClientRect(&rect);//获取客户区
HRGN rgn;
rgn = CreateRoundRectRgn(0,0,rect.Width()+5,rect.Height(),140,90);//创建圆角椭圆
SetWindowRgn(rgn,TRUE);
CreateRoundRectRgn函数原型为
HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse);
参数
nLeftRect
[in] 左上角的x坐标
nTopRect
[in] 左上角的y坐标
nRightRect
[in] 右下角x坐标.
nBottomRect
[in] 右下角y坐标
nWidthEllipse
[in] 创建椭圆的宽
nHeightEllipse
[in] 创建椭圆的高
返回值
成功则返回这个图像的句柄。失败返回NULL
本文介绍如何通过在对话框类中的OnInitDialog()函数内添加特定代码来创建一个圆形窗口。使用CreateRoundRectRgn函数定义窗口的形状,并通过SetWindowRgn设置窗口区域。
310

被折叠的 条评论
为什么被折叠?



