C#winForm中设置在PictureBox上的Label控件透明

    技术2022-05-11  65

    设置PictureBox控件上的Label控件透明的步骤:

    1) 新建一个PictureBox控件,名称是pbxImage2) 新建一些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, newSolidBrush(L.ForeColor), L.Left - picBack.Left, L.Top - picBack.Top);        }      }    } 


    最新回复(0)