winform控件背景透明设置

1,第一种方法,设置背景透明色

 这种方法适合父容器就是窗体,控件直接再窗体中

 2,第二种方法,在窗体初始化的时候,设置父容器

这种方法适合控件在父容器(比如PictureBox)中

  public FrmLogin()
        {
            InitializeComponent();
            this.label1.Parent = this.pic_Main;//设置背景透明,这一句设置label在哪个panel里面
            this.label2.Parent = this.pic_Main;
            //this.label2.BackColor = System.Drawing.Color.Transparent;//label背景色透明,这里有父容器,在这里无效
            this.chk_UsePwd.Parent = this.pic_Main;
        }

  

原文地址:https://www.cnblogs.com/baozi789654/p/12572151.html