2013-11-15 88 views
-1

PictureBox在C#中是矩形的。我想要加載圖片在PictureBox的圈子來操縱它。將圖片加載到圓形圖片盒

怎麼辦?

+3

檢查這 - http://stackoverflow.com/questions/7731855/rounded-edges-in-picturebox-c-sharp可能重複 – DevT

回答

1

here: -

[Rectangle r = new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height); 
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath(); 
int d = 50; 
gp.AddArc(r.X, r.Y, d, d, 180, 90); 
gp.AddArc(r.X + r.Width - d, r.Y, d, d, 270, 90); 
gp.AddArc(r.X + r.Width - d, r.Y + r.Height - d, d, d, 0, 90); 
gp.AddArc(r.X, r.Y + r.Height - d, d, d, 90, 90); 
pictureBox1.Region = new Region(gp);][2]