Unfortunately there is no magic property that when set changes the form
caption colour.  The caption bar painting is done by Window when
DefaultWindowProc handles the WM_NCPAINT message.  It will always use the
default windows colours to do the painting.  This is why the same form's
caption looks different when run under NT 3.51, NT4 / 95 and NT 2000 / 98.

To change the colour you will have to trap the WM_NCPAINT message, then
paint the all non-client areas yourself.  This works, but requires quite a
lot of drawing code.

One way that I have used in the past is to create a captionless form.  Place
a TLabel on the form and align it to alTop.  This label becomes your pseudo
caption.  You will also have to place "buttons" on the form to mimic the
system caption buttons.  You then need to trap the WM_NCHITTEST message and
if the mouse pointer is inside the label you return HTCAPTION.  This way,
the form can be dragged by the caption, like a normal form.  If you look at
the help for WM_NCHITTEST, you will see the list of possible return values.
Of course, this technique only works if you don't have a menu.

You can create this form and make it the ancestor of all your other forms
(as suggested by Leigh).


Hope this helps.
Dennis.

-----Original Message-----

Yes, that is what we want to do but I don't know how to actually set the
colour of the caption bar on a form.  From your response I take it that
there is a simple property that I am not seeing.  What is it?

Rob

>Dear Rob,
>
>>>In particular we want to force the colour of the caption bar on all forms
and not allow the changes made in the windows >>>colour setting place to
change it.
>
>You may develop a TForm inherited class which you can force the colour of
the caption bar. And all your forms inherited >from that class.
>
>Best Regards
>Leigh Wanstead

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to