How to Create a Modern UI Login Form in C#

By FoxLearn 7/20/2024 2:34:21 AM   31.53K
Creating a modern UI login form using Metro Framework in a C# Windows Forms Application involves using Metro controls to achieve a sleek and modern look.

Creating a modern UI login form using the Metro Framework in C# can give your application a sleek and professional appearance. Here's a step-by-step guide on how to do it

How to create a metro login form in C#

To create the metroframework modern ui sample project in c#, you need to install the metroframework by right-clicking on your project, then select Manage NuGet Packages -> Search metro framework -> Install it on your project.

Metro Framework is an open source using c# ui framework, you can download and install metro framework from nuget or github. If you don't see the metro framework toolbox, you can view How to download and install metro framework

To make the metro modern ui login, you can drag and drop PictureBoxMetroTextBox, MetroButton and MetroCheckBox controls from the Visual Studio toolbox to your winform, then design a simple ui metro login form as shown below.

design metro login form in c#

To make the metro or modern ui style windows application in c#, you need to change inheritance from the Form to MetroForm, then you can add code to handle metroframework change color for the metro form as the following c# code.

// Set the StyleManager property of your form to the StyleManager component to apply the Metro styles
public partial class Form1 : MetroFramework.Forms.MetroForm//Replace System.Windows.Forms.Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        //initialize metro style or theme
        this.StyleManager = metroStyleManager1;
        metroStyleManager1.Theme = MetroFramework.MetroThemeStyle.Light;
        metroStyleManager1.Style = MetroFramework.MetroColorStyle.Green;
    }
}

Through this tutorial, you learned how to use metroframework to design the modern ui, as well as how to use some controls in the metro framewok library in c# winform ui design.

VIDEO TUTORIAL