BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

title bar color...

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
ben
Guest





PostPosted: Wed Jun 23, 2004 12:40 pm    Post subject: title bar color... Reply with quote



Hello,
i'm looking for changing the color of the title bar on a form...

Back to top
Joris Van Damme
Guest





PostPosted: Wed Jun 23, 2004 1:16 pm    Post subject: Re: title bar color... Reply with quote



"ben" <benoitmail (AT) mail (DOT) com> wrote

Quote:
Hello,
i'm looking for changing the color of the title bar on a form...

Check out WM_NCPAINT, IIRC.


Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html



Back to top
ben
Guest





PostPosted: Thu Jun 24, 2004 10:51 am    Post subject: Re: title bar color... Reply with quote



1- What is IIRC??

2- WM_NCPAINT has only one parameter which is the region to update..i
don't want to shape again all my window but just the title bar..nothing
else more simple????



Joris Van Damme a écrit:
Quote:
"ben" <benoitmail (AT) mail (DOT) com> wrote in message
news:40D97A2E.4050605 (AT) mail (DOT) com...

Hello,
i'm looking for changing the color of the title bar on a form...


Check out WM_NCPAINT, IIRC.


Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html




Back to top
Joris Van Damme
Guest





PostPosted: Thu Jun 24, 2004 11:52 am    Post subject: Re: title bar color... Reply with quote

"ben" <benoitmail (AT) mail (DOT) com> wrote

Quote:
1- What is IIRC??

If I remember correctly, it means 'if I remember correctly'.

Quote:
2- WM_NCPAINT has only one parameter which is the region to update..i
don't want to shape again all my window but just the title bar..nothing
else more simple????

There's something for sure that will change that system setting, title bar
color that is. But there's a number of reasons why it's probably not what
your after.
a) it changes color of all title bars, of course
b) it is the user's priviledge to set it, code should not do that, many
users may get annoyed, I know get annoyed if code fiddles with anything like
that and my immediate respons is uninstall.

I don't remember how this system setting can be changed, but it shouldn't be
to hard to find, and probably someone else here will tell you this.

Apart from changing this system setting, the only option is to paint the
non-client area yourself. WM_NCPAINT is the windows message that you can
trap and handle to do just that.

I hope this is helpfull,

Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html



Back to top
Erik Turner
Guest





PostPosted: Thu Jun 24, 2004 12:31 pm    Post subject: Re: title bar color... Reply with quote

Maybe this will get you started. The following code draws a maroon border
around the entire form and a yellow border around the title bar.

Erik Turner
Indialantic, Florida



type
TMainForm = class(TForm)
StatusBar: TStatusBar;
procedure FormResize(Sender: TObject);

private
{ Private declarations }
procedure DrawBorder;
procedure WMNCPaint(var Msg: TMessage); message WM_NCPAINT;
procedure WMNCActivate(var Msg: TMessage); message WM_NCACTIVATE;
procedure WMNCHitTest(var Msg: TMessage); message WM_NCHITTEST;

public
{ Public declarations }
end;
procedure TMainForm.DrawBorder;
var
ACanvas : TCanvas;
BorderSizeX : Integer;
BorderSizeY : Integer;
MenuSizeX : Integer;
MenuSizeY : Integer;
begin
ACanvas := TCanvas.Create;
try
ACanvas.Handle := GetWindowDC(Handle);

BorderSizeX := GetSystemMetrics(SM_CXSIZEFRAME);
BorderSizeY := GetSystemMetrics(SM_CYSIZEFRAME);

MenuSizeY := GetSystemMetrics(SM_CYCAPTION);
MenuSizeX := Self.Width - BorderSizeX * 2;

ACanvas.Pen.Color := clYellow;
ACanvas.Brush.Style := bsClear;
ACanvas.Rectangle(BorderSizeX,
BorderSizeY,
BorderSizeX+MenuSizeX,
BorderSizeY+MenuSizeY);

ACanvas.Pen.Color := clMaroon;
ACanvas.Brush.Style := bsClear;
ACanvas.Rectangle(0, 0, Self.Width, Self.Height);
finally
ACanvas.Free;
end; {try}
end;


procedure TMainForm.WMNCActivate(var Msg: TMessage);
begin
inherited;
DrawBorder;
end;

procedure TMainForm.WMNCPaint(var Msg: TMessage);
begin
inherited;
DrawBorder;
Msg.Result := 1;
end;

procedure TMainForm.FormResize(Sender: TObject);
begin
inherited;
DrawBorder;
end;

procedure TMainForm.WMNCHitTest(var Msg: TMessage);
begin
inherited;
DrawBorder;
end;


"ben" <benoitmail (AT) mail (DOT) com> wrote

Quote:
1- What is IIRC??

2- WM_NCPAINT has only one parameter which is the region to update..i
don't want to shape again all my window but just the title bar..nothing
else more simple????



Back to top
Camiel Wijffels
Guest





PostPosted: Sun Jun 27, 2004 5:12 pm    Post subject: Re: title bar color... Reply with quote

Hi Ben,
I have posted a answer to this very same question, on 11 june 2004 to this
newsgroup.
--
Best regards, Camiel Wijffels
"ben" <benoitmail (AT) mail (DOT) com> schreef in bericht
news:40D97A2E.4050605 (AT) mail (DOT) com...
Quote:
Hello,
i'm looking for changing the color of the title bar on a form...




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.