在MFC对话框上发出静态文本控件的透明属性 [英] Issue with the transparent property of static text control on MFC dialog

查看:139
本文介绍了在MFC对话框上发出静态文本控件的透明属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含2个静态控件的对话框。在那一个静态文本具有透明背景而另一个静态文本不在同一个对话框中。

没有为它们中的任何一个设置特殊属性。

为什么会出现这种情况?



我想知道除了覆盖WM_CTLCLR(onctlclr()功能)或WM_ERASEBKGND(onEraseBkgnd()之外,我们可以通过任何方式实现任何静态文本控制的透明度功能),只需修改rc文件或更改控件的属性或类似的东西??



提前感谢:)



我尝试了什么:



1)分析资源文件和rc脚本没有多大帮助。

2)如果我们覆盖WM_CTLCLR或EM_ERASEBKGND消息它会起作用,但我想知道为什么会发生这种情况。

3)以下链接给出了一点深入了解为什么透明度问题出现在对话框https://blogs.msdn.microsoft.com/oldnewthing/20111028-00/?p=9243上的静态文本,

但它没有用多个静态文本控件解释一个是透明的而另一个是不透明的。

I have a dialog with 2 static controls. In that one static text has transparent background and the other one doesn't on the same dialog.
No special property set for either of them.
why this behavior ?

And I wanted to know that can we achieve transparency for any static text control by any means other than overriding WM_CTLCLR (onctlclr() functionality) or WM_ERASEBKGND (onEraseBkgnd() functionality) , just by modifying rc file or by changing the property of the control or anything like that??

Thanks in advance :)

What I have tried:

1) analyzing Resource files and rc scripts did not help much.
2) It is going to work if we override WM_CTLCLR or EM_ERASEBKGND messages, but I want to know why its happening like that.
3) the following link gives a little insight of why transparency issue comes up with static text on dialog "https://blogs.msdn.microsoft.com/oldnewthing/20111028-00/?p=9243",
but it doesn't explain with multiple static text controls one being transparent and other's not.

推荐答案

检查属性在资源编辑器中 - 可能它们在某些细节上有所不同。



其他常见原因:

*他们不是同一类型或类别

*资源ID不是与消息处理程序中的相同



文章对话框中的透明静态文本应该为您的问题提供一些见解和示例代码。
Check the properties in the resource editor - maybe they differ in some detail.

Other common reason:
* that they arent the same type or class
* the resource ID isnt the same as in the message handler

The article Transparent Static Text In Dialogs should give you some insights and example code for your problem.


这篇关于在MFC对话框上发出静态文本控件的透明属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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