首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

控件透明有关问题

2012-02-02 
控件透明问题label3.BackColor System.Drawing.Color.Transparentlabel3.Parent pictureBox1这样设

控件透明问题
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);     }   } 

热点排行