Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
how to make a round window form in c# .net
Posted

I assume you're talking about rounded corners for windows forms.
Rounded Corner Form in C# Winforms.[^]

You can use the classes of Graphics to override the Onpaint
method of the form ( where the form is printed ) you may need to read about
using GDI classes.
Here is good example on GDI+ Tutorial for Beginners[^]

Also have a look on Rectangle.Round Method[^] for reference.
 
Share this answer
 
C#
protected void RePaint()
{
   GraphicsPath graphicpath = new graphicsPath();
    graphicpath.StartFigure();
    graphicpath.AddArc(0,0,25,25,180,90);
    graphicpath.AddLine(25,0,this.Width-25,0); 
    graphicpath.AddArc(this.Width-25,0,25,25,270,90); 
    graphicpath.AddLine(this.Width,25,this.Width,this.Height-25);
    graphicpath.AddArc(this.Width-25,this.Height-25,25,25,0,90);
    graphicpath.AddLine(this.Width-25,this.height,25,this.Height);
    graphicpath.AddArc(0,this.Height-25,25,25,90,90);
    graphicpath.CloseFigure();
    this.Region = new Region(graphicpath)
}
 
Share this answer
 
v2
That's not too difficult - all you need to do is modify the Region property:

C#
GraphicsPath path = new GraphicsPath();
path.AddEllipse(new Rectangle(0, 0, 300, 300));
Region = new Region(path);
However, it is never that simple! If you make a round form (or even button) you are going to have to do all the drawing yourself: title bar, close button, borders, stretch arrows, the lot.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900