Thursday, January 27, 2011

How to: Create Transparent Windows Forms

Many applications uses transparent background form like Adobe products. "What if my applications should look like the same as this applications" So I try to find how it works.

After several hours searching in the internet I found different ways to create transparent windows form. Different approach and explanations, some says transparency is not supported by visual studio and others put codes that doesn't work.

I found some replies in different forums, I combined all the ideas and found out that it works. Here is the code for transparency of your window background.

Code:
public frmLogin()
{
InitializeComponent();

this.TransparencyKey = BackColor;
this.SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor,true);
this.BackColor = System.Drawing.Color.Transparent;
}

Properties:
Backcolor = control

I created it perfect with image design. Try it!