user965369
user965369

Reputation: 5733

winapi - SetLayeredWindowAttributes with LWA_COLORKEY only sets pixels to either fully opaque or fully transparent?

The border of my frame is white (0xfffffffe). The interior of my frame is black (0xff000000). I want to make the border translucent (alpha value of 100), and the interior opaque. Obviously, I've used SetLayeredWindowAttributes to do this, but it's not working.

This variation: SetLayeredWindowAttributes(RGB(0xxff, 0xff, 0xfe), 100, LWA_COLORKEY) sets the border to alpha of 100, but the interior as completely transparent.

This variation: SetLayeredWindowAttributes(RGB(0xxff, 0xff, 0xfe), 100, LWA_COLORKEY | LWA_ALPHA) sets the interior to an alpha of 100, but sets the border as completely transparet.

How can I make the interior opaque and the border transparent? I can't use multiple top-level windows to achieve the affect in this situation.

Upvotes: 1

Views: 2183

Answers (1)

casablanca
casablanca

Reputation: 70691

Instead of SetLayeredWindowAttributes, use UpdateLayeredWindow. You can pre-render your entire frame including any transparency onto a 32-bit bitmap, select it into a DC and pass this to UpdateLayeredWindow.

Upvotes: 1

Related Questions