Popup Notification in Windows Forms

In this article, I will explain how to create popup notifications in a Windows Forms app using Visual Studio 2017.
Windows Forms desktop alert component is used to display a popup window and implement notifications to users about a particular event is occured. It is easy to integrate the desktop alert control in a WinForms app and customize it based on your needs using C# API.
To add a control to a WinForms app, you can simply drag and drop it from Toolbox to a Form.
STEP 1: Create a Project
Create a new windows Forms app in Visual Studio 2017. 
New Project -> Visual C# -> Windows Forms App (.NET Framework). See below.
STEP 2: Designer Page
By default your Form should be opened in the designer. If not, double click on the Form1.cs.
Now, let's add a button control to the form by dragging a Button control from Toolbox to the form. You may also want to change the properties of the button.
STEP 3: Install Nuget Packages
Download and install Tulpep.NotificationWindow that is used to implement popup notification in the app. 
STEP 4: Coding
To add an alert window to the Form, create a handler for the Button Click event by simply double clicking on the button. Now, copy and paste the following C# code snippet to the button click event handler. This code creates a PopupNotifier, sets its title and text and openss the popup. You can change the content the way you like. 
  1. private void button1_Click(object sender, EventArgs e)  
  2.         {  
  4.             PopupNotifier popup = new PopupNotifier();  
  5.             popup.TitleText = "BE HAPPY";  
  6.             popup.ContentText = "Thank you";  
  7.             popup.Popup();// show  
  8.         }  
  9.     }  
STEP 5: Run and test
Now, simply run the app and click on Show button. You will notice a popup is opened at the right botton of your Windows screen.
You can also customize the way your notification window looks by setting its properties.
STEP 6: Additional design
You can also add an image to the popup notifiaction.
To display an image along wih the text in the popup notification, add an Image as a sesource to the app and set the Image property of the control. 
The code snippet sets the Image property of the control. You can also create an Image at run time by using the Image class, if you like to use an external file. 
A WinForms app can implement desktop notifications by using the PopupNotifier control. In this basic article, we saw how to use the control to implement a windows notification and set its properties.