How to create a transparent window in Windows Form Application

In this post we are going to see how to create a transparent Form in Windows Form application. 

1) Click on File -> New Project and select Windows Forms Application.


2) Click on the Form and select View Code

 3) Type the following code in the constructor.
this.TransparencyKey = (BackColor);
Now your entire code will be
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.TransparencyKey = (BackColor);
        }
    } 
4)Build and run your application either by CTRL+F5 or click on Start.
 
 5)You will get a transparent form as shown below.
 
 6)To remove the border and to display a transparent image on the Form, First add a Picture Box from the ToolBox and add a picture to it from Properties -> Background Image and select a transparent image from your computer.

To fit the selected image in the Picture Box, change the BackgroundImageLayout property to Stretch.

7) If you want to remove the border of the Form, go to properties of the form and change FormBorderStyle to None and Run your application.

Comments

Popular posts from this blog

Optical Charactor Recognition (OCR) in C#

Installing MASM on Windows (32 bit or 64 bit)