Making Login form's corners as smooth curves for appearance
This is an article, Just shown how to make the corners of the login form as curvers to improve the apearance.Recently I had done some code to improve the appearance of the login screen for one of my windows application. After doing this a small bit of change it added a value to the whole application as it look good.
Hope this may help the developers to add a value to their application too.
This is a few set of lines of code to implement the logic.
Just before going for the code Select an image and set that image as a background for the login form or the form which you need using the BACKGROUND property of the form.
Add this following set of code in the code behind
using System.Drawing.Drawing2D;
Include this above namespace
public static GraphicsPath RoundRect(Rectangle rectangle, int roundRadius)
{
Rectangle innerRect = Rectangle.Inflate(rectangle, -roundRadius, -roundRadius);
GraphicsPath path = new GraphicsPath();
path.StartFigure();
path.AddArc(RoundBounds(innerRect.Right - 1, innerRect.Bottom - 1, roundRadius), 0, 90);
path.AddArc(RoundBounds(innerRect.Left, innerRect.Bottom - 1, roundRadius), 90, 90);
path.AddArc(RoundBounds(innerRect.Left, innerRect.Top, roundRadius), 180, 90);
path.AddArc(RoundBounds(innerRect.Right - 1, innerRect.Top, roundRadius), 270, 90);
path.CloseFigure();
return path;
}
private static Rectangle RoundBounds(int x, int y, int rounding)
{
return new Rectangle(x - rounding, y - rounding, 2 * rounding, 2 * rounding);
}
Place this above code in your form and call this function in the form load event.
GraphicsPath oPath = new GraphicsPath();
oPath = RoundRect(this.ClientRectangle, 15);
this.Region = new Region(oPath);
Hope this code snippet will add some appearance to your application.
Thanks Marshal. Making the corners of the form curvy. But it will look better if we can make the curve smoother.