怎样可以使对话框中的static控件实现透明?

beast78 2006-07-14 04:53:18
或者有实现好的类代码
...全文
317 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
PackChen 2006-07-15
  • 打赏
  • 举报
回复
我建议使用SetWindowStyle和GetWindowStyle
那样会减少资源的浪费
flyhigh 2006-07-15
  • 打赏
  • 举报
回复
对对话框的OnCtlColor中处理
goodboyws 2006-07-14
  • 打赏
  • 举报
回复
http://www.codeguru.com/cpp/controls/staticctrl/datadisplaycontrols/article.php/c8829/
scottliu 2006-07-14
  • 打赏
  • 举报
回复
透明是啥意思,透过去看到桌面的东西?
折腾_苏州 2006-07-14
  • 打赏
  • 举报
回复
从CStatic类中继承一个子类CStaticEx,映射WM_PAINT消息:
void CStaticEx::OnPaint()
{
CPaintDC dc(this); // device context for painting
CString strText;
GetWindowText(strText);
dc.SetTextColor(RGB(200,100,15));
dc.SetBkMode(TRANSPARENT);
dc.TextOut(0,0,strText);
// Do not call CStatic::OnPaint() for painting messages
}

然后静态文本框变量设置为CStaticEx类型

15,976

社区成员

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

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