about me
Google_search
hot
latest
photos
links
重画label ,使其背景透明
来源:原创 作者:arron 日期:2008-03-05 热度:两Label重帖,背景透明
效果如图:

同学帮忙搞定的
程序代码public class myLabel : Label
{
protected override void InitLayout()
{
base.InitLayout ();
SetLabelTransparence();
}
private void SetLabelTransparence()
{
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddString(this.Text,
this.Font.FontFamily,
(int)(FontStyle.Bold),
this.Font.Size,
new Point(this.ClientRectangle.Left,this.ClientRectangle.Top),
new StringFormat());
this.BackColor = this.ForeColor;
this.Region = new Region(path);
}
}
{
protected override void InitLayout()
{
base.InitLayout ();
SetLabelTransparence();
}
private void SetLabelTransparence()
{
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddString(this.Text,
this.Font.FontFamily,
(int)(FontStyle.Bold),
this.Font.Size,
new Point(this.ClientRectangle.Left,this.ClientRectangle.Top),
new StringFormat());
this.BackColor = this.ForeColor;
this.Region = new Region(path);
}
}
↑ 返回顶部
Tags: 重画label ,使其背景透明
广告位招租,广告代号:gg468
↑ 返回顶部
search
advertise




![还你真实的开幕式!震撼美图[转]【连载】](/up_files/image/Article/2008/08/12/57015031.jpg)



