public Form1()
{
InitializeComponent();
this.pictureBox1.Paint += new PaintEventHandler(pictureBox1_Paint);
}
void pictureBox1_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 - this.pictureBox1.Left, L.Top - this.pictureBox1.Top);
}
}
}
用此代码虽然在pictureBox上实现了label的透明,但是在程序运行后label上面的字却看不见了,请教各位大侠是怎么回事???