Delphi-Quellcode:
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
TabText: string;
APoint: TPoint;
begin
with TPageControl(Control).Canvas do
begin
Brush.Color := ClRed;
FillRect(Rect);
TabText := TPageControl(Control).Pages[TabIndex].Caption;
with Control.Canvas do
begin
APoint.x := (Rect.Right - Rect.Left) div 2 - TextWidth(TabText) div 2;
APoint.y := (Rect.Bottom - Rect.Top) div 2 - TextHeight(TabText) div 2;
TextRect(Rect, Rect.Left + APoint.x, Rect.Top + APoint.y, TabText);
end;
end;
end;
' PageControl1.OwnerDraw auf True setzen