设置PictureBox控件上的Label控件透明的步骤:
1) 新建一个PictureBox控件,名称是pbxImage
2) 新建一些Label控件,放在PictureBox上
3) 添加PictureBox的Paint事件
4) 添加如下代码:
//pbxImage is PictureBox control
private void pbxImage_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 - picBack.Left, L.Top - picBack.Top);
}
}
}