|
hi, I making a windows application in C# and my problem is that, I have a square picture. I need to draw a circle on it, and everything outside that circle to be set to a certain color, so the image looks framed
On other words, I want to crop a circle form a rectangular picture
Any hints/any help ..........
thanks in advance
- Moved byTaylorMichaelLMVPTuesday, April 21, 2009 1:26 PMWF related
-
| | babitas Tuesday, April 21, 2009 11:47 AM | You can do this by using a texture brush...Try this..
theImage = new Bitmap("YouImage.jpg");
Graphics g = GetGraphichs(); // such as e.Graphics inside a OnPaint method;
Brush tBrush = new TextureBrush(theImage, new Rectangle(0, 0,theImage.Width, theImage.Height));
g.FillEllipse(tBrush, GetTheRectangle());
tBrush.Dispose();
Doing stuff with .net - Marked As Answer byBruce.ZhouMSFT, ModeratorMonday, April 27, 2009 1:50 AM
- Proposed As Answer byMoim Hossain Tuesday, April 21, 2009 11:57 AM
-
| | Moim Hossain Tuesday, April 21, 2009 11:55 AM | Make this PictureBox control round: public partial class Form1 : Form { public Form1() { InitializeComponent(); System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.AddEllipse(0, 0, pictureBox1.Width, pictureBox1.Height); pictureBox1.Region = new Region(path); } } Please post these questions to Windows Forms General in the future. Hans Passant.- Marked As Answer byBruce.ZhouMSFT, ModeratorMonday, April 27, 2009 1:51 AM
-
| | nobugz Tuesday, April 21, 2009 12:31 PM | You can do this by using a texture brush...Try this..
theImage = new Bitmap("YouImage.jpg");
Graphics g = GetGraphichs(); // such as e.Graphics inside a OnPaint method;
Brush tBrush = new TextureBrush(theImage, new Rectangle(0, 0,theImage.Width, theImage.Height));
g.FillEllipse(tBrush, GetTheRectangle());
tBrush.Dispose();
Doing stuff with .net - Marked As Answer byBruce.ZhouMSFT, ModeratorMonday, April 27, 2009 1:50 AM
- Proposed As Answer byMoim Hossain Tuesday, April 21, 2009 11:57 AM
-
| | Moim Hossain Tuesday, April 21, 2009 11:55 AM | hi,
where i can find GetGraphichs(); method .... plz help me.. thanks | | babitas Tuesday, April 21, 2009 12:18 PM | Make this PictureBox control round: public partial class Form1 : Form { public Form1() { InitializeComponent(); System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.AddEllipse(0, 0, pictureBox1.Width, pictureBox1.Height); pictureBox1.Region = new Region(path); } } Please post these questions to Windows Forms General in the future. Hans Passant.- Marked As Answer byBruce.ZhouMSFT, ModeratorMonday, April 27, 2009 1:51 AM
-
| | nobugz Tuesday, April 21, 2009 12:31 PM |
|