Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a circle shape label in Window Form?

Tags:

c#

.net

winforms

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.

like image 786
Ryan Fung Avatar asked Jul 05 '12 15:07

Ryan Fung


2 Answers

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);
like image 136
mathieu Avatar answered Oct 19 '22 04:10

mathieu


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);
like image 6
Micah Armantrout Avatar answered Oct 19 '22 04:10

Micah Armantrout