Im PageControl.OnDrawTab:
PC1 ist das PageControl
Delphi-Quellcode:
procedure TForm1.PC1DrawTab(Control: TCustomTabControl; TabIndex: Integer;
const Rect: TRect; Active: Boolean);
var TabCaption: string; CaptionX: Integer; CaptionY: Integer;
begin
if Active then
begin
Control.Canvas.Brush.Color := clLime;
Control.Canvas.Font.Color:= clRed;
Control.Canvas.Font.Style := Control.Canvas.Font.Style + [fsBold];
end else
begin
Control.Canvas.Brush.Color := clBtnFace;
Control.Canvas.Font.Color:= clBlack;
//hier kann man einen Block von Tabs anders färben, wenn man will
if TabIndex in [25..30]
then Control.Canvas.Brush.Color := clSkyBlue;
Control.Canvas.Font.Style := Control.Canvas.Font.Style - [fsBold];
end;
Control.Canvas.FillRect(Rect);
//hier kann man die Tabs umbenennen, wenn man will
with Control.Canvas do
begin
TabCaption := INTTOSTR(TabIndex+1);
CaptionX := Rect.Left + ((Rect.Right - Rect.Left - TextWidth(TabCaption)) div 2);
CaptionY := Rect.Top + ((Rect.Bottom - Rect.Top - TextHeight('Gg')) div 2);
FillRect(Rect);
TextOut(CaptionX, CaptionY, TabCaption);
end;
end;