vb.net 无法将标签的背景色设置为透明
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20393482/
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
Not able to set the Backcolor of label as Transparent
提问by sameerag
Using properties of "label" not able to set the backcolor as transparent ... when i select the color transparent from the option which is showing some color as backcolor, if transparent works properly must show background instead of some colors. please help
使用“标签”的属性无法将背景色设置为透明......当我从将某些颜色显示为背景色的选项中选择透明颜色时,如果透明工作正常,则必须显示背景而不是某些颜色。请帮忙
回答by OSKM
If you add a control at design time when setting the background to transparent it 'displays' the background of the form not the control on which it was placed unless that control is a container such as a panel.
如果在设计时将背景设置为透明时添加控件,它会“显示”表单的背景,而不是放置它的控件,除非该控件是诸如面板之类的容器。
2 options:
2个选项:
1 place the label on a panel and the label then displays the panel background (which can be a picture if that is what you are trying to do)
1 将标签放在面板上,然后标签显示面板背景(如果这是您想要做的,可以是图片)
2 place the label programatically i.e.
2 以编程方式放置标签即
dim Label1 As New Label
Control.Controls.Add(Label1)
Label1.BackColor = Color.Transparent

