控件透明有关问题
控件透明问题
label3.BackColor = System.Drawing.Color.Transparent;
label3.Parent = pictureBox1;
这样设置之后label上的文字都消失了,
那不是和visible 为false的效果
能否能让其显示文字而且透明
------解决方案--------------------
pictureBox1.Controls.Add(label3);
------解决方案--------------------
自己做一个继承label的控件
------解决方案--------------------
label3.BackColor = System.Drawing.Color.Transparent;
label3.Parent = pictureBox1;
这样设置之后label上的文字都消失了,
那不是和visible 为false的效果
能否能让其显示文字而且透明
------解决方案--------------------
pictureBox1.Controls.Add(label3);
------解决方案--------------------
自己做一个继承label的控件
------解决方案--------------------
- C# code
protected override void OnPaintBackground(PaintEventArgs pe) { if(this.Parent.BackgroundImage == null || this.Parent ==null) base.OnPaintBackground (pe); else { pe.Graphics.DrawImage(this.Parent.BackgroundImage, 0, 0, new Rectangle(this.Location.X, this.Location.Y, this.Width, this.Height), System.Drawing.GraphicsUnit.Pixel); } }