如何使控件的背景透明 [英] how to make control's background transparent

查看:236
本文介绍了如何使控件的背景透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我想将静态文本和复选框的背景设置为透明.现在,我将图片框作为背景,并更改了图片框的颜色,但是不能更改静态文本的背景色.解决方案是什么?

hello,
I want to make background of static text and check box as transparent. Right now I put picture box as background and I change the color of picture box But it can not be changed the the background color of static text. What is the solution?

推荐答案

处理对话框中的OnCtlColor消息.

在那里找到控件:
Handle the OnCtlColor message in your dialog.

Once there search for the control:
if(pWnd->GetDlgCtrlID() == m_staticTransparent.GetDlgCtrlID())


然后将pDC的背景色设置为TRANSPARENT.
并将hbr也设置为NULL_BRUSH. (GetStockObject ...)

HTH ...:thumbsup:


Then set the background color of the pDC to TRANSPARENT.
And set also the hbr to NULL_BRUSH. (GetStockObject...)

HTH... :thumbsup:


琼的答案很好.

您可以以本文为例:
对话框中的透明静态文本 [ http://www.codeguru.com/cpp/controls/editctrl/backgroundcolor/article. php/c3929 [ ^ ]

----------------------
您是否查看过有关透明编辑控件的文章?
CEdit& CStatic透明度控制 [^ ]
Joan''s answer is good.

You may have a look to this article as an example:
Transparent Static Text In Dialogs[^]
And/or this one:
http://www.codeguru.com/cpp/controls/editctrl/backgroundcolor/article.php/c3929[^]

----------------------
Did you check this article about transparent edit control?
CEdit & CStatic Transparency Control[^]


这篇关于如何使控件的背景透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆