4th february

Pascal

Delphi

VCL Components

CLX Components

Glyphs, Icons, Cursors, Videos

Logos

Sample Projects

Tools

Articles, Code Examples, Tips

Links

Code Examples

How to remove PageControl's border?
based on code by Petr Vones

Printable Version

interface

type
  TMainForm = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
  ...
    procedure FormCreate(Sender: TObject);
  ...
  private
    FOriginalPageControlWndProc: TWndMethod;
    procedure PageControlWndProc(var Message: TMessage);
  ...
  end;

 ...

implementation

 ...

procedure TMainForm.PageControlWndProc(var Message: TMessage);
begin
  FOriginalPageControlWndProc(Message);
  with Message do
  if (Msg = TCM_ADJUSTRECT) and (Message.WParam = 0) then
  begin
    InflateRect(PRect(LParam)^, 4, 4);
    Dec(PRect(LParam)^.Top, 2)
  end;
end;

procedure TMainForm.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  with PageControl1 do
  begin
    for I := 0 to PageCount - 1 do
      Pages[I].TabVisible := False;
    FOriginalPageControlWndProc := WindowProc;
    WindowProc := PageControlWndProc;
    ActivePage := TabSheet1;
    Realign;
  end;
end;