有时候根据具体需求,我们可能要改变窗口的形状。使用API函数SetWindowRgn可以改变一个窗体的可见范围。使用API函数CreateRoundRectRgn()函数可以创建一个圆角矩形区域。

 

 

 
  
  1. void OnSize(UINT nType, int cx, int cy) 
  2.     CDialog::OnSize(nType, cx, cy); 
  3.  
  4.     // TODO: 在此处添加消息处理程序代码 
  5.     CRgn MyRgn; 
  6.     CRect rect; 
  7.     GetWindowRect(&rect); 
  8.     rect -= rect.TopLeft(); 
  9.     MyRgn.CreateRoundRectRgn(rect.left,rect.top, rect.right, rect.bottom, 3,3); 
  10.     SetWindowRgn(MyRgn,TRUE);