AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Page control

Ein Thema von schniede · begonnen am 29. Okt 2003 · letzter Beitrag vom 29. Okt 2003
Antwort Antwort
Christian Seehase
(Co-Admin)

Registriert seit: 29. Mai 2002
Ort: Hamburg
11.123 Beiträge
 
Delphi 11 Alexandria
 
#1

Re: Page control

  Alt 29. Okt 2003, 23:22
Moin Schniede,

ich hab' Dir mal ein Beispiel gebastelt, wie ich es machen würde.

Delphi-Quellcode:
const
  _iTabCount = 5;
  _aclInitTabColors : array [0.._iTabCount-1] of TColor = (clBlue,clRed,clGreen,clYellow,clWhite);
  _asTabCaptions : array [0.._iTabCount-1] of string = (' Hauptansicht',' Einzelans.- Kunde',' Best. Waren ges.',' Warenlager',' Eigene Umsätze');

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    procedure PageControl1DrawTab(Control: TCustomTabControl; TabIndex: Integer; const Rect: TRect; Active: Boolean);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
    FaclTabColors : array [0.._iTabCount-1] of TColor;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
  TabIndex: Integer; const Rect: TRect; Active: Boolean);

begin
  Control.Canvas.Brush.Color := FaclTabColors[TabIndex];
  Control.Canvas.FillRect(Rect);
  Control.Canvas.TextOut(Rect.Left+5,Rect.Top+3,_asTabCaptions[TabIndex]);
end;

procedure TForm1.FormCreate(Sender: TObject);

var
  i : integer;

begin
  for i := low(FaclTabColors) to high(FaclTabColors) do begin
    FaclTabColors[i] := _aclInitTabColors[i];
    with TTabSheet.Create(self) do begin
      Parent := PageControl1;
      PageControl := PageControl1;
      Name := 'ts'+IntToStr(i+1);
    end;
  end;
end;

end.
Wobei ich eigentlich die Konstanten noch in eine eigenen Unit auslagern würde.
Tschüss Chris
Die drei Feinde des Programmierers: Sonne, Frischluft und dieses unerträgliche Gebrüll der Vögel.
Der Klügere gibt solange nach bis er der Dumme ist
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:57 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz