 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ben Guest
|
Posted: Wed Jun 23, 2004 12:40 pm Post subject: title bar color... |
|
|
Hello,
i'm looking for changing the color of the title bar on a form...
|
|
| Back to top |
|
 |
Joris Van Damme Guest
|
|
| Back to top |
|
 |
ben Guest
|
Posted: Thu Jun 24, 2004 10:51 am Post subject: Re: title bar color... |
|
|
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:
|
|
| Back to top |
|
 |
Joris Van Damme Guest
|
Posted: Thu Jun 24, 2004 11:52 am Post subject: Re: title bar color... |
|
|
"ben" <benoitmail (AT) mail (DOT) com> wrote
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
|
Posted: Thu Jun 24, 2004 12:31 pm Post subject: Re: title bar color... |
|
|
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
|
Posted: Sun Jun 27, 2004 5:12 pm Post subject: Re: title bar color... |
|
|
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 |
|
 |
|
|
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
|
|