allow transparency on tab control

flynn

Regular
Joined
Jul 28, 2005
Messages
59
I have placed a Tab control and a Text box on a form. I have a background image on the form. If I place a Checkbox on the form and set its backcolor to "Transparent", the image will show through the Checkbox. I would like to have the Tab control and Text control do the same thing, but they don't support the backcolor property.

The MSN messenger program allows something similar to this. The textboxes allow the image to show through. This is what I am after.

Is there something I'm missing? Does anyone have code that shows how to do this?

tia,
flynn
 
Theres nothing your missing the simple answer is it's not possible. The complicated answer is you could probabably achieve the right effect by inheriting from the controls, but it will be very difficult to achieve the effect your after especially if you wanted it to be a generalised control that you could use anywhere. There are a number of simpler ways to fake it in a single application by overriding the paint methods of the controls, and passing the control a copy of the image to be drawn but its a pretty nasty method.
 
Thanks Cags, I was hoping for better news.

Have you seen the way MSN Messenger looks? Surely they don't get the transparency to work by doing as you have described.
 
Yes MSN Messenger is very nice, it's also made by Microsoft, as is the .Net Framework. Contrary to popular belief they are pretty good programmers. Unfortunately, to the best of my knowledge they have provided no easy method to achieve this look.

I'd have thought theres a reasonable chance that MSN doesn't use the Textbox control at all, but instead simply mimics the functionality. Even if it does I'd imagine that it's heavily modified in order to achieve this effect. I'm pretty sure you can run MSN Messenger without the .Net Framework, which furthermore means its written in unmanaged code which is far more powerfull, but can be alot more complicated to work with.
 
The biggest problem is that certain .Net controls, generally the more complicated ones, like the TextBox, are simple wrappers for the Win32 common controls and are only extensible (beyond relatively simple enhancements) with Win32 style subclassing: intercepting messages, modifying flags, and stuff like that. Fun stuff, especially when you aren't familiar with that sort of thing. .Net 2.0 adds extensibility to some controls (ListView, TreeView), but that doesn't get you anywhere on textboxes.

BUT... luckily for you, I went to tremendous lengths to find this. I haven't really looked at it too closely, and I don't know how good it is, but it is a start.
 
Back
Top