vba 将标签背景色更改为默认值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23780885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change Label BackColor to default
提问by Kjenos
I was wondering how i can change the Background Color of a label in a UserForm back to the default value? (Transparent or like the UserFormcolor)
我想知道如何将用户窗体中标签的背景颜色更改回默认值?(透明或像用户窗体颜色)
Info_Label.BackColor = xlTransparent
or
或者
Info_Label.BackColor = xlNone
doesn't work.
不起作用。
回答by Gareth
If you want the label to be transparent, you need to set the BackStyle
property like so:
如果您希望标签透明,则需要BackStyle
像这样设置属性:
'Transparent
Info_Label.BackStyle = 0
'Opaque
Info_Label.BackStyle = 1
Alternatively, to return the label BackColor
to the default color:
或者,要将标签BackColor
恢复为默认颜色:
Info_Label.BackColor = vbButtonFace
回答by Alex K.
The default colour is the enum value vbButtonFace
so:
默认颜色是枚举值,vbButtonFace
因此:
Info_Label.BackColor = vbButtonFace
Or to match the current form:
或者匹配当前表单:
Info_Label.BackColor = me.BackColor