hi all
i need a function to draw circle in a pictuerBox
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mahesh ChandPosted Jun 19, 2007, 9:07 AM
Check your online email account from which you contacted me.
Best,
Mahesh
Mahesh ChandPosted Jun 18, 2007, 12:14 PM
This is Mahesh from C# Corner. Can you contact me when you get a chance through this site by selecting Contact Author on my author profile page here:
http://www.c-sharpcorner.com/Authors/AuthorDetails.aspx?AuthorID=mahesh
Thanks,
Mahesh
Essam AliPosted Jun 18, 2007, 11:19 AM
AlanPosted Jun 18, 2007, 10:04 AM
Bitmap
bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); Graphics g = Graphics.FromImage(bmp); Pen blackPen = new Pen(Color.Black);int
x = pictureBox1.Width/4; int y = pictureBox1.Height/4; int width = pictureBox1.Width / 2; int height = pictureBox1.Height / 2; int diameter = Math.Min(width, height);g.DrawEllipse(blackPen, x, y, diameter, diameter);
pictureBox1.Image = bmp;
If the PictureBox already contains a bitmap, replace the first and second lines with:Graphics g = Graphics.FromImage(pictureBox1.Image);