将图片加载到圆形图片框

时间:2013-11-15 06:15:54

标签: c#

C#中的

PictureBox是矩形的。我想在PictureBox圈中加载图片来操纵它。

怎么做?

1 个答案:

答案 0 :(得分: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]