Einzelnen Beitrag anzeigen

Benutzerbild von Jens Schumann
Jens Schumann

Registriert seit: 27. Apr 2003
Ort: Bad Honnef
1.644 Beiträge
 
Delphi 2009 Professional
 
#2
  Alt 30. Jun 2003, 21:18
Hallo Florian,
probier's mal damit:
Delphi-Quellcode:
type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    procedure PageControl1DrawTab(Control: TCustomTabControl;
      TabIndex: Integer; const Rect: TRect; Active: Boolean);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
  TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
  TabCaption : String;
  TabRect : TRect;
begin
  TabRect:=Rect;
  InflateRect(TabRect,-4,-2);
  TabCaption:=TPageControl(Control).Pages[TabIndex].Caption;
  With Control.Canvas do
    begin
    Case TabIndex of
      0 : Brush.Color:=clRed;
      1 : Brush.Color:=clLime;
      2 : Brush.Color:=clBlue;
      else
        Brush.Color:=clBtnFace;
      end;
    Brush.Style:=bsSolid;
    FillRect(Rect);
    Brush.Style:=bsClear;
    DrawText(Handle,PChar(TabCaption),-1,TabRect,dt_singleline+dt_left+dt_vcenter);
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  PageControl1.OwnerDraw:=True;
end;

end.
  Mit Zitat antworten Zitat