9

As you all know, a label is usually in a square or rectangle shape. I really need to make circle shaped label. Can anyone please tell me is this possible or at least point me in a right direction?

Sorry, just to make things clear. I want a circle shaped label. Not just drawing a circle on the screen.

Ryan Fung
  • 2,069
  • 9
  • 38
  • 60
  • 1
    Homework? If so, please add a homework tag. – Mark Kram Jul 05 '12 at 15:34
  • Is your question about drawing a circle in Windows Forms or writing text which follows a circle path ? – pikzen Jul 05 '12 at 15:44
  • It is not for a homework. I need to make a circle label. A circle shape label instead of square or rectangle shape ones. – Ryan Fung Jul 05 '12 at 17:05
  • Do you mean horizontal text wrapped to fit within a circle, or text that is rendered along a circular path? – mbeckish Jul 05 '12 at 17:35
  • 1
    You can make a composite Control consisting of a drawn graphics cicle, as Micah Armatrout mentioned, encircling a regular Label. It's not clear what sort of behavior you want (if you want multiple lines, where you want the text to start, left to right, or top to bottom, etc. – Stealth Rabbi Jul 05 '12 at 17:38
  • possible duplicate of [Rounded edges in picturebox C#](http://stackoverflow.com/questions/7731855/rounded-edges-in-picturebox-c-sharp) – Hans Passant Jul 05 '12 at 18:05
  • It is nothing to do with text or anything like that. All I want is simple I want my label to became a circle shape. lblLabel = a circle shape. That way I can set background color of the circle label. – Ryan Fung Jul 05 '12 at 23:56
  • Although it is not really perfect, but it helped! Thanks:) – Ryan Fung Jul 06 '12 at 01:44

2 Answers2

14

You can set the Region property of your Label :

var path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddEllipse(0, 0, label1.Width, label1.Height);

this.label1.Region = new Region(path);
mathieu
  • 30,974
  • 4
  • 64
  • 90
6
System.Drawing.Graphics graphics = this.CreateGraphics();
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(100, 100, 200, 200);
graphics.DrawEllipse(System.Drawing.Pens.Black, rectangle);
Micah Armantrout
  • 6,781
  • 4
  • 40
  • 66