WinFrom透明Label
//构造函数
public from1()
{
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
}
//图片框重绘函数
private void pictureBox2_Paint(object sender, PaintEventArgs e)
{
foreach (Control c in this.Controls)
{
if (c is Label)
{
Label l = (Label)c;
l.Visible = false;
e.Graphics.DrawString(l.Text, l.Font, new SolidBrush(l.ForeColor), l.Left - pictureBox2.Left, l.Top - pictureBox2.Top);
}
}
}