Attached are a couple of examples of creating transparent windows with visible controls, but that don't allow the clicks to pass through.
Since SetLayeredWindowAttributes API won't let you set the Alpha for just one particular colour - you have to make use of two forms.
Glass Form.zip
Very simple example of creating a glass form. Although this (and the following example) use two forms, all the code and controls are contained on one form - with the fEvents object being used to manage events on the transparent parts.
Tracing App.zip - updated
This example is a bit more complex (and actually has function!). This app acts a sheet of glass which youu can move around and draw on. Here's my tracing of a monkey:
http://www.vbforums.com/attachment.p...chmentid=49310
(if you think that's bad then imagine what it would've been like if I'd drawn it free hand!)
The bottom-right circle can be used for resizing. The top and bottom left are for moving the form. And the three buttons in the top-right do their usual things. Click on the block of colour to change the colour and use the dropdown to change the pen width. The save button will allow you to save your picture, but the background will be Cyan and not transparent (although you could implement saving with transparency if you wanted)
In order to stop the taskbar button changing (from checked to unchecked) everytime you clicked on a transparent part of the form, the app finds the button and ensure's it stays checked - I've avoided using subclassing at all.
When the form gets big the drawing time really slows down - there are probably much better ways of drawing on the form - but since I know very little about graphics, I haven't attempted them.
I can't really think of real world application for this code - but it's pretty cool :cool:
Any bugs, comments or suggestions then post them here.
As with anything using SetLayeredWindowAttributes, this will only work on 2000 and later
If you find that the clicks are passing through then try increasing the number in the SetTrans fEvents, 1 line in Form_Load - see posts #9, #10 & #11
