Message Box With Metro Framework In Windows Form Application

INTRODUCTION

In this article, I am going to explain how to create metro message box using Metro framework in Windows form applications. Metroframe work is the Modern UI. Metro Message Box is similar to that of traditional Message boxes used to display a message but there are some additional features in metro message box compared to that of the traditional message box.

METRO FRAMEWORK

Metro Framework is an open source DLL that is used to create high-level Windows Forms application. It has its own development tools which are used for WindowsForms and a  clear and High-quality UI theme.

Let's start the project.

STEP 1 - Start the Project

Click New project, then select Visual C# on the left, then windows and then select Windows Forms Application. Name your Project  "MetroMessageBox" and then click ok.

Windows Forms

STEP 2 - Download and Install Metroframework

Right-click, on your project, select Manage NuGet Packages--->search metro framework---->Download and Install NuGet packages. It will be downloaded automatically and it will have its own collection of tools to be used for UI Design.

Windows Forms 
 
Windows Forms 

Follow the code given below to create Metro styled form in simple Windows.Forms.The output will appear as given below in the figure in step 4.
  1. public partial class Form1: MetroFramework.Forms.MetroForm  
STEP 4 - Drag and Drop controls

After successful installation, you are able to drag and drop controls into your form in the same way as you did with the traditional method. Drag and Drop Metro Button into the form. And change the text of the button as shown in the Message. 

Windows Forms
 
Windows Forms

STEP 5 - Coding for Button Click Event

Following code is given now in the screenshot for Button click event to display the message. 

Windows Forms

STEP 6 - Compile and Run

Compile and Run the Project. Whenever the Metro Button has clicked the output appears in the screenshot given below. When the Button is clicked the message box with the following text appears.

Windows Forms

STEP 7 - Additional Design

Additional Design can be added to the project by using the code given below in the screenshot. Here, I added ok and cancel.

Windows Forms
 
Windows Forms

Summary

Finally, we have created the message box with Metroframework in Visual Studio 2017. In case you encounter a problem with the code, feel free to comment below. In my next article, I will explain how to install Metro frame from NuGet in Visual Studio 2017 in detail. Thanks for reading my article.


Similar Articles