Razvi
Razvi

Reputation: 2818

How can I make only a part of the window transparent? (WIN32)

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?

Upvotes: 4

Views: 2682

Answers (3)

jussij
jussij

Reputation: 10580

Take a look at the SetLayeredWindowAttributes Win32 function.

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

Upvotes: 2

Anurag Uniyal
Anurag Uniyal

Reputation: 88847

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.

Upvotes: 4

Related Questions