views:

260

answers:

3

How can I make for example only a rectangle inside the window have opacity like 50% or something like that and for that part to have the effect of WS_EX_TRANSPARENT so that mouse clicks will go through it?

+2  A: 

I do not think it is possible simply by setting WS_EX_TRANSPARENT, but it can be accomplished using two windows, create a window with a hole, using SetWindowRgn, and inside that hole put another transparent window using WS_EX_LAYERED and WS_EX_TRANSPARENT styles.

Anurag Uniyal
Can just the reduced opacity part be done somehow else or would you do it in the same way just for that too?
Razvi
+1  A: 

Take a look at the SetLayeredWindowAttributes Win32 function.

It can be used to set the opacity and transparency of a window.

jussij
+1  A: 

Take a look at this CodeProject article: Cool, Semi-transparent and Shaped Dialogs with Standard Controls for Windows 2000 and Above.

Cristian Adam