winform重写控件——圆框图片

public class MyPic:PictureBox
        {
            protected override void OnCreateControl()
            {
                GraphicsPath gp = new GraphicsPath();
                gp.AddEllipse(this.ClientRectangle);
                Region region = new Region(gp);
                this.Region = region;
                gp.Dispose();
                region.Dispose();
                base.OnCreateControl();
            }
          
        }

你可能感兴趣的:(winform重写控件——圆框图片)