Windows Forms: Metro TextBox in C#

This post shows you how to create Metro TextBox using Metro Framework Modern UI Design in c# .net windows forms application.

To play the demo, you should create a new windows forms application project. By clicking New Project, then select Visual C# on the left, and then select Windows Forms Application.

Next, Enter your project name is "MetroTextBoxDemo", then click OK.

You need to install the metro framework to your project, by right-clicking on your project, then select Manage NuGet Packages -> Search 'metro framework' and install it.

If you don't see the metro framework in your toolbox, you can view How to download and install metro framework

To make your winform support metro framework, you need to change the inheritance from the Form to MetroForm as the following c# code.

public partial class Form1 : Form

to

public partial class Form1 : MetroFramework.Forms.MetroForm

Dragging the MetroTextBox controls from your visual studio toolbox to your windows forms application, then design a simple UI as shown below.

c# metro textbox

Finally, Add code to handle the button click event as the following c# code.

private void metroTextBox4_ButtonClick(object sender, EventArgs e)
{
    MetroFramework.MetroMessageBox.Show(this, "Thank you for watching this video !", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

Through the c# example above, I've show you how to create MetroMessageBox using MetroFramework, add the click event handler to MetroTextBox button.

VIDEO TUTORIAL