Thema: Delphi Page control

Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.167 Beiträge
 
Delphi 12 Athens
 
#12

Re: Page control

  Alt 29. Okt 2003, 23:02
Delphi-Quellcode:
Unit Unit1;

Interface
  Uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;

  Type TForm1 = Class(TForm)
      Procedure FormCreate(Sender: TObject);
      Procedure PageControlDrawTab(Control: TCustomTabControl; TabIndex: Integer; Const Rect: TRect; Active: Boolean);
    Private
      _clTabColors: Array[0..4] of TColor;
    End;

  Var Form1: TForm1;

Implementation
  {$R *.dfm}

  Procedure TForm1.FormCreate(Sender: TObject);
    Begin
      _clTabColors[0] := Farbe11;
      _clTabColors[1] := Farbe12;
      _clTabColors[2] := Farbe13;
      _clTabColors[3] := Farbe14;
      _clTabColors[4] := Farbe15;
    End;

  Procedure TForm1.PageControlDrawTab(Control: TCustomTabControl; TabIndex: Integer; Const Rect: TRect; Active: Boolean);
    Const _sTabCaptions: Array[0..4] of Otring = (' Hauptansicht', ' Einzelans.- Kunde', ' Best. Waren ges.', ' Warenlager', ' Eigene Umsätze');

    Begin
      Control.Canvas.Brush.Color := _clTabColors[TabIndex];
      Control.Canvas.FillRect(Rect);
      Control.Canvas.TextOut(Rect.Left+5,Rect.Top+3,_sTabCaptions[TabIndex]);
    End;

End.
oder so

Delphi-Quellcode:
Unit Unit1;

Interface
  Uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;

  Type TForm1 = Class(TForm)
      Procedure FormCreate(Sender: TObject);
      Procedure PageControlDrawTab(Control: TCustomTabControl; TabIndex: Integer; Const Rect: TRect; Active: Boolean);
    End;

  Var Form1: TForm1;
    _clTabColors: Array[0..4] of TColor;

Implementation
  {$R *.dfm}

  Procedure TForm1.FormCreate(Sender: TObject);
    Begin
      _clTabColors[0] := Farbe11;
      _clTabColors[1] := Farbe12;
      _clTabColors[2] := Farbe13;
      _clTabColors[3] := Farbe14;
      _clTabColors[4] := Farbe15;
    End;

  Procedure TForm1.PageControlDrawTab(Control: TCustomTabControl; TabIndex: Integer; Const Rect: TRect; Active: Boolean);
    ...
End.
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat