windows forms - usercontrol background transparent?

Posted on 2004-11-03
Last Modified: 2012-06-27
this is a windows application on .net
i have a user control that needs to be transparent to show the image displayed on the background panel?
can someone plz help me on this?
Question by:heartguy123
    1 Comment

    Accepted Solution

    To make a transparent user control you should just have to add three lines to your constructor:

    SetStyle(ControlStyles.Opaque, false); // optional
    SetStyle(ControlStyles.SupportsTransparentBackColor, !value);
    BackColor = Color.FromArgb(0,0,0,0);

    Another suggestion I have run across is define the region that is drawn for the shape of the user control by setting the Region property. You can define an irregular pattern and even cut "holes" in the middle of your control using the GraphicsPath object.


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now