The easiest way is to set the Region:
myPictureBox.Image = Image.FromFile(@"D:\Temp\MyPic.jpg");
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(myPictureBox.DisplayRectangle);
myPictureBox.Region = new Region(gp);
I did this control to remove the pixels on the edges
public class CirclePictureBox : PictureBox
{
public CirclePictureBox ()
{
}
protected override void OnPaint(PaintEventArgs e)
{
System.Drawing.Brush brushImege;
try
{
Bitmap Imagem = new Bitmap(this.Image);
Imagem = new Bitmap(Imagem, new Size(this.Width - 1, this.Height - 1));
brushImege = new TextureBrush(Imagem);
}
catch
{
Bitmap Imagem = new Bitmap(this.Width - 1, this.Height - 1, PixelFormat.Format24bppRgb);
using (Graphics grp = Graphics.FromImage(Imagem))
{
grp.FillRectangle(
Brushes.White, 0, 0, this.Width - 1, this.Height - 1);
Imagem = new Bitmap(this.Width - 1, this.Height - 1, grp);
}
brushImege = new TextureBrush(Imagem);
}
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
GraphicsPath path = new GraphicsPath();
path.AddEllipse(0, 0, this.Width - 1, this.Height - 1);
e.Graphics.FillPath(brushImege, path);
e.Graphics.DrawPath(Pens.Black, path);
}
}