实现圆角窗口

见习学术士 2010-07-14 11:24:00
对话框程序,想实现圆角窗口。
自绘了标题栏,如果实现类似QQ那种圆角?

下面是贴图绘制标题栏

//平铺标题
pBitmap->LoadImage(CUtilityEx::GetBasePath() + "images\\bgtitle.bmp");
pBitmap->GetBitmap(&bmpInfo);
pOldBitmap=(CBitmap*)pDisplayMemDC->SelectObject(pBitmap);
pDC->BitBlt(m_rtTitle.left, m_rtTitle.top, m_rtTitle.Width(), m_rtTitle.Height(), pDisplayMemDC, 0, 0, SRCCOPY);
pDisplayMemDC->SelectObject(pOldBitmap);
pBitmap->DeleteObject();
...全文
445 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjfhgdx 2010-07-15
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 muzizongheng 的回复:]
CRgn rgn;
rgn.CreateRoundRectRgn(0, 0, 100, 100, 4, 4);

SetWindowRgn(rgn, FALSE);
[/Quote]
放到OnInitDialog()函数中就可以了
muzizongheng 2010-07-15
  • 打赏
  • 举报
回复
CRgn rgn;
rgn.CreateRoundRectRgn(0, 0, 100, 100, 4, 4);

SetWindowRgn(rgn, FALSE);
aa313619456 2010-07-15
  • 打赏
  • 举报
回复
如果系统不支持CreateRoundRectRgn函数呢,比如说windows mobile中
iqyely 2010-07-15
  • 打赏
  • 举报
回复
来学习下。
xpbhere 2010-07-15
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 hastings 的回复:]

C/C++ code
int SetWindowRgn(

HWND hWnd, // handle to window whose window region is to be set
HRGN hRgn, // handle to region
BOOL bRedraw // window redraw flag
);
[/Quote]
2楼正解。
在OnSize里面去设置圆角。
楼上说的在OnInitDialog()去设置的话如果这个窗体时可变大变小的,就错了。
Eleven 2010-07-14
  • 打赏
  • 举报
回复
CRgn,SetWindoRgn();
hastings 2010-07-14
  • 打赏
  • 举报
回复
int SetWindowRgn(

HWND hWnd, // handle to window whose window region is to be set
HRGN hRgn, // handle to region
BOOL bRedraw // window redraw flag
);

15,979

社区成员

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

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