C#winform picturebox形状变成圆形_重绘-默认是长方形

C#winform picturebox形状变成圆形_重绘-默认是长方形

private void Form1_Load(object sender, EventArgs e)
        {
            //GraphicsPath gp = new GraphicsPath();
            //gp.AddEllipse(this.ClientRectangle);
            //Region region = new Region(gp);
            //this.Region = region;
            //gp.Dispose();
            //region.Dispose();
            //base.OnCreateControl();

           

                GraphicsPath gp = new GraphicsPath();

                gp.AddEllipse(pictureBox2.ClientRectangle);

                Region region = new Region(gp);

                pictureBox2.Region = region;

                gp.Dispose();

                region.Dispose();

          



        }

 

posted @ 2021-10-06 15:04  txwtech  阅读(921)  评论(0编辑  收藏  举报