怎样实现圆边的对话框?

winter_sui 2003-11-07 01:09:57
像realone那样的窗口,不是方方正正的。怎样实现?有源代码给发一份:
suipengbo@fc-cn.com
...全文
55 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
icr_mio 2003-11-07
  • 打赏
  • 举报
回复

嘿嘿,再改
CRgn rgnRound;
BOOL bRegRound = rgnRound.CreateRoundRectRgn(0,0,300,300,50,50);
int bRgnWnd = SetWindowRgn(rgnRound.operator HRGN(), TRUE);
SetWindowRgn(m_hWnd,rgnRound, TRUE);
rgnRound.DeleteObject();

楼主,你可以自己创建任何形状的区域,然后调用SetWindowRgn让窗体变成那个形状
wuxfBrave 2003-11-07
  • 打赏
  • 举报
回复
CRgn rgnRound;
BOOL bRegRound = rgnRound.CreateRoundRectRgn(0,0,100,100,20,20);
int bRgnWnd = SetWindowRgn(rgnRound.operator HRGN(), TRUE);
rgnRound.DeleteObject();

SetWindowRgn(m_hWnd, rgnRound, TRUE);
lasery 2003-11-07
  • 打赏
  • 举报
回复
你需要先创建HRGN hRgn区域,也就是你窗口的形状,作为SetWindowRgn参数。
如 CRgn rgnRound;
BOOL bRegRound = rgnRound.CreateRoundRectRgn(0,0,100,100,20,20);
int bRgnWnd = SetWindowRgn(rgnRound.operator HRGN(), TRUE);
rgnRound.DeleteObject();
Neoking 2003-11-07
  • 打赏
  • 举报
回复
好像不是阿!上面的好想不对!也许我做错了!
call SetWindowRgn(Me.hWnd, 0, True)
第二个参数换过n次,最后一个也换过!没有变化!
icr_mio 2003-11-07
  • 打赏
  • 举报
回复
用这个函数

SetWindowRgn
The SetWindowRgn function sets the window region of a window. The window region determines the area within the window where the system permits drawing. The system does not display any portion of a window that lies outside of the window region

int SetWindowRgn(
HWND hWnd, // handle to window
HRGN hRgn, // handle to region
BOOL bRedraw // window redraw option
);
Parameters
hWnd
[in] Handle to the window whose window region is to be set.
hRgn
[in] Handle to a region. The function sets the window region of the window to this region.
If hRgn is NULL, the function sets the window region to NULL.

bRedraw
[in] Specifies whether the system redraws the window after setting the window region. If bRedraw is TRUE, the system does so; otherwise, it does not.
Typically, you set bRedraw to TRUE if the window is visible.

Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Windows NT/2000/XP: To get extended error information, call GetLastError.

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧