drawing an elipse around some text

  • Thread starter Thread starter ian
  • Start date Start date
I

ian

Hello,

does anyone know how I can draw a ring (it needs to be an elipse) around
some text. (The text is three characters long)

Thanks.
 
Where is the text located. Is it a label on your form, or somwhere else. If
it is a label on your form, you can use GDI+. Check the code below :

Graphics g = Graphics.FromHwnd(this.Handle);
g.DrawEllipse(new Pen(Color.Blue, 3), 10, 10, 40, 40);

hope this helps

Fitim Skenderi
 
To draw an ellipse around an arbitrary rectangle you need to make the
ellipse 1.414 (root 2) times the length of the side so obtain the rectangle
that the text will fit in using MeasureString and then create the ellipse to
go around it using 1.414*Rect.Width and 1.414*Rect.Height for the
dimensions.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com
 
Back
Top