怎么创建圆形窗口

来源:互联网 发布:淘宝买新百伦鞋子哪店 编辑:程序博客网 时间:2024/05/03 13:27

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 

原创粉丝点击