Form (Window) border color

Posted on 2005-04-22
Last Modified: 2008-01-09
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.

Question by:frog
    LVL 12

    Accepted Solution

    procedure TForm1.FormCreate(Sender: TObject);
      BorderStyle := bsNone;

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

    procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
      // move the form without caption bar
      if Button = mbLeft then
          SendMessage(Self.Handle, WM_SYSCOMMAND, 61458, 0);

    Author Comment

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now