具体代码如下:
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); } }
}
在Windows Mobile 开发中Label控件没有Paint事件。
如果要更改Label控件上的text,在每次更新完text之后,必须刷新pictureBox控件,Label上的text才能够被更新。
C#中如何使PicturesBox控件上的Label控件背景透明,参见http://blog.csdn.net/ESunshine1985/archive/2009/05/06/4154154.aspx