问题描述
我想使标签在图片框上透明.
我写的代码是
Hi,
I want to make label trasparent on a picture box.
The code I have written is
label1.parent = picturebox1;// not working
label1.backcolor = color.transparent//
即使这不起作用
在此先感谢
even this is not working
Thanks in advance
推荐答案
this.label1.Parent = this.pictureBox1;
this.label1.BackColor = Color.Transparent;
label1.parent = picturebox1; // not working
label1.backcolor = color.transparent // even this is not working
如果出于您的目的使用相同的编码,则它将永远不会运行,因为label1不包含 parent 或 backcolor
的定义
由于关键字区分大小写,因此请使用 Parent而不是parent 和 BackColor而不是backcolor .
使用给定的代码
if you are same coding for your purpose then it will never run it because of label1 does not contain difinition of parent or backcolor
use Parent instead of parent and BackColor instead of backcolor because of keyword are case sensitive.
Use given code
label1.Parent= pictureBox1;
label1.BackColor = Color.Transparent;
它可以工作:)
it works :)
public HowToForm()
{
InitializeComponent();
Label lbl = new Label();
lbl.Parent = pictureBox1;
lbl.BackColor = Color.Transparent;
lbl.ForeColor = Color.Black;
lbl.Visible = true;
lbl.Text = "DnG";
}
谢谢,
DnG
-------------------------------------------------- ----------------
如果您觉得有用,请记住将其标记为答案:).
Thanks,
DnG
------------------------------------------------------------------
Please remember to mark this as answer if you find it useful :).
这篇关于标签透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!