?
Solved

How to make a control derived from TCustomControl transparent

Posted on 2004-11-18
5
Medium Priority
?
900 Views
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?

Thanks!
0
Comment
Question by:Balder1978
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
andrewjb earned 1000 total points
ID: 12613390
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+
0
 
LVL 2

Author Comment

by:Balder1978
ID: 12613679
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 ;)

Thanks!
0
 
LVL 2

Author Comment

by:Balder1978
ID: 12827546
The only thing I needed to do was to set Canvas.Brush.Style to bsClear.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

862 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