How to Create a Metro TextBox in C#
By FoxLearn 7/20/2024 2:34:08 AM 22.88K
Open your Visual Studio, then 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.
How to use Metro TextBox in C#
The MetroTextBox is a control provided by the MetroFramework library, which is a set of modern controls for Windows Forms applications. To use MetroTextBox in C#, you'll first need to install the MetroFramework package using NuGet Package Manager.
Right-clicking on your project, then select Manage NuGet Packages -> Search for 'MetroFramework' and install it.
If you don't see the metro framework in your toolbox, you can view How to download and install metro framework
After installing MetroFramework, you need to add the necessary using
directive at the top of your main form.
using MetroFramework.Forms; using MetroFramework;
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
Drag and drop MetroTextBox controls from your Visual Studio toolbox to your windows forms application, then design a simple UI as shown below.
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 shown you how to integrate and use MetroTextBox in C# Windows Forms application.
VIDEO TUTORIAL
- How to use Modern UI Metro Framework in C#
- How to Create CPU and Memory Monitor using Metro Modern UI in C#
- How to Create a Metro Modern Flat UI Dashboard in C#
- How to Download and Install Metro Framework
- How To Use Metro Framework Metro Style Manager in C#
- How to Create a Modern Windows 8 UI with the Metro Framework in C#
- How to create a Metro Wait Form in C#
- How to create a Metro Message Box in C#