Visual C# : How To Make Windows Form Background Color Transparent

in csharp •  5 years ago 

Learn How To Make Windows Form Background Color to Transparent in C# using Visual Studio.

If you like this video then Do share the video in the article to your friends or in your social media accounts. You can also subscribe to the YouTube channel.

I recommend checking out C# in Nutshell Definitive Reference book. You can get a lot of answers to your questions. Plus the new edition of the book can cover some of the latest topics too.

Check out the below video to learn How To Make Form Background Color to Transparent using Visual Studio Professional IDE.

How To Make Form Background Color to Transparent in C# using Visual Studio?

Why would anyone want to make their windows form transparent? There are times when you want your application to be more fancy and inclusive to the desktop colors. And in such case having some level of transparency or say opacity definitely helps with the design.

Though many app developers avoid the transparency effect to speed up the windows form loading. So basically what we are doing is adjusting the transparency level and setting the Windows form to load with some transparent effect.

Usually we are going to call the following code in our constructor when the form loads.

System.Drawing.Color.Transparent

As you can see this allows the forms to be drawn complete transparent and we don't get to adjust the transparency as well.

You have to override the following function in order to have the transparent background.


    protected override void OnPaintBackground(PaintEventArgs e)
    {
        //set the transparency here
    }

This is the way we do it in the video as well. A little bit different though.

So that's simple demo for you to check out.

If you are interested in learning more, check out Visual C# Winforms Tutorials.

I hope the information here helps you. I'd appreciate if you like the video and share it with others.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!