-2

I would like to change title bar in my application. I have no idea how should I do. Can you help me?

I found many examples in Delphi but doesnt work in Lazarus.

How should I start, what I should do to change for example title bar colour or buttons?

Mlody87
  • 425
  • 1
  • 7
  • 19
  • What operating system? On Windows at least the system determines theme and apps don't get a look in. On Delphi there is VCL styles whereby the entries app is painted by the framework. Not for the faint of heart. – David Heffernan Oct 11 '16 at 06:19

2 Answers2

2

Turn off the original title bar by setting the form's BorderStyle to bsNone. Then add a top-aligned panel as new title bar which you can colorize in any way and to which you can add SpeedButtons or whatever you want. In order to be able to drag the window with the mouse on the title bar you should add these event handlers for the panel's OnMouseDown and OnMouseMove:

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer
      );
  private
    FMouseDownPt: TPoint;
  public
  end;

procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  FMouseDownPt := Point(X, Y);
end;

procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
  if (ssLeft in Shift) then
  begin
    Left := Left + (X - FMouseDownPt.X);
    Top := Top + (Y - FMouseDownPt.Y);
  end;
end; 
wp_1233996
  • 784
  • 1
  • 4
  • 12
-1

If by title bar you mean the title of your form then all you need to do is:

    Form1.Caption := 'The title of the form';

This is for a form with name Form1.