How to make a control derived from TCustomControl transparent

Posted on 2004-11-18
Last Modified: 2013-11-17
I have a custom control which inherits TCustomControl. On this control there is a TShape, TImage and a TLabel control.
All of the controls added, I can make transparent, but does anyone know how I could make the TCustomControl transparent?

Question by:Balder1978
    LVL 12

    Accepted Solution

    You can do it with TGraphicControl simply by not drawing in a region.

    However, TCustomControl is a "proper" windows control with a windows handle. So it's harder.

    I can't find my example at the moment. But, roughtly speaking, you have to create regions that cover the apporpriate bits you want to draw on, then use SetWindowRgn(..) API call to tell windows that it's an odd-shaped window.

    This doesn't work on all windows versions, but I think it's OK on WIN95+
    LVL 2

    Author Comment

    Thanks for the info.
     I'm pretty nww at this, so if you have any example code, please let me know.
    But I'll fiddle with it for a couple of hours ;)

    LVL 2

    Author Comment

    The only thing I needed to do was to set Canvas.Brush.Style to bsClear.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    728 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

    19 Experts available now in Live!

    Get 1:1 Help Now