Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Oct : Getting DrawFrameControl To Work!
| Subject: | Getting DrawFrameControl To Work! |
| Posted by: | "Marcelo Grossi" (magros..@nelogica.com.br) |
| Date: | Wed, 11 Oct 2006 16:46:58 |
Hi,
I'm trying to draw a custom button on my titlebar. I managed to make
that work but I wanted a button very similar to those already on the
TitleBar (minimize, maximize, close, restore). I found out that the function
DrawFrameControl would do it for me. That is, to draw a button exactly alike
those on the titlebar respecting the XP "Look and Feel".
Using that function makes the Windows to draw "a title bar button" on
the titlebar BUT it changes the "Look and Feel".
For instance: If I don't use the DrawFrameControl function my Titlebar
is Blue and the buttons are all blue too with white contour and all. The
close button has a red background and everything, all neat and pretty. BUT
when I use the DrawFrameControl function the "look and feel" of the entire
window changes! The titlebar buttons are all gray and ugly!
Please help! Below is the code I'm using:
My Drawing function ....
....
Canvas.Handle := GetWindowDC(Self.Handle); {Get Device context for drawing}
try
DrawFrameControl(Canvas.Handle, Rect, DFC_CAPTION, DFCS_CAPTIONRESTORE);
// <-- This changes the Look and Feel
//Canvas.Rectangle(Rect); // <--- This Don't
finally
ReleaseDC(Self.Handle, Canvas.Handle);
Canvas.Handle := 0;
end;
....
Thanks in advance,
Marcelo Grossi