G
Guest
Hi,
I am deriving from Panel and I paint the client and non-client area of the
panel myself. I am drawing a bitmap in both the client and non-client area.
The bitmap has an alpha channel so the edges are neatly anti-aliased. I am
using the WM_NC* messages to distinquish between the client and non-client
area. I set the ControlStyles to both OptimizedDoubleBuffered and
SupportTransparentBackColor and set the BackColor to a transparent color.
All of this works fine, except for the fact that the non-client area does
not use double buffering or transparency. It seems that the control styles
are used for the client area only?
I have read Bob Powell's faq on Windows Forms and he also has a section on
transparent forms. However, if you set the WS_EX_TRANSPARENT style, you will
never be able to use double buffering, since Bob's technique will invalidate
the parent's window, causing flickering. Microsoft's approach for copying the
parent's background into an offscreen surface, and then copying your own
graphics over it sounds like the only possible way to deal with double
buffered transparent controls.
The frustrating thing is that .NET has everything in place with the
background painting. I've checked reflector and OnPaintBackground indeed
paints a piece of the parent control into the graphics object, when
SupportTransparentBackColor is set and the backcolor alpha is not opaque.
Great, but it seems that OnPaintBackground only paints the client area and
not the non-client area...
Did I miss something? Bottom line is: does anybody know how to handle double
buffered, transparent, alpha blended non-client area's? I'm counting on you,
Bob .
Regards,
Jelle van der Beek
I am deriving from Panel and I paint the client and non-client area of the
panel myself. I am drawing a bitmap in both the client and non-client area.
The bitmap has an alpha channel so the edges are neatly anti-aliased. I am
using the WM_NC* messages to distinquish between the client and non-client
area. I set the ControlStyles to both OptimizedDoubleBuffered and
SupportTransparentBackColor and set the BackColor to a transparent color.
All of this works fine, except for the fact that the non-client area does
not use double buffering or transparency. It seems that the control styles
are used for the client area only?
I have read Bob Powell's faq on Windows Forms and he also has a section on
transparent forms. However, if you set the WS_EX_TRANSPARENT style, you will
never be able to use double buffering, since Bob's technique will invalidate
the parent's window, causing flickering. Microsoft's approach for copying the
parent's background into an offscreen surface, and then copying your own
graphics over it sounds like the only possible way to deal with double
buffered transparent controls.
The frustrating thing is that .NET has everything in place with the
background painting. I've checked reflector and OnPaintBackground indeed
paints a piece of the parent control into the graphics object, when
SupportTransparentBackColor is set and the backcolor alpha is not opaque.
Great, but it seems that OnPaintBackground only paints the client area and
not the non-client area...
Did I miss something? Bottom line is: does anybody know how to handle double
buffered, transparent, alpha blended non-client area's? I'm counting on you,
Bob .
Regards,
Jelle van der Beek