Form (Window) border color

How do I change the color of the border of the form/window of my application?

Sometimes the client area will be transparent and the normal btncolor border is hard to see.

There will also be several instances of the application and I want each to have a different border color.

frogAsked:
Who is Participating?
 
Ivanov_GConnect With a Mentor Commented:
procedure TForm1.FormCreate(Sender: TObject);
begin
  BorderStyle := bsNone;
end;

procedure TForm1.FormPaint(Sender: TObject);
var
  Rect     : TRect;
begin
  // get the form rectangle
  Rect.Left   := 0;
  Rect.Top    := 0;
  Rect.Bottom := ClientHeight;
  Rect.Right  := ClientWidth;
  // draw the whole area
  with Canvas do
    begin
      // form color
      Brush.Color := clBlue;
      // set border color
      Pen.Color := clBlack;
      Rectangle(0, 0, ClientWidth, ClientHeight);
    end;
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  // move the form without caption bar
  if Button = mbLeft then
    begin
      ReleaseCapture;
      SendMessage(Self.Handle, WM_SYSCOMMAND, 61458, 0);
    end;
end;
0
 
frogAuthor Commented:
Thanks  Ivanov_G
It doesn't quite work but I guess it's because of how I'm removing/showing the client.
I get the idea though, so I'll paint a fake border around the edge of the client and reduce my 'client' by the width of that border.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.