1.先把 PageControl1 的 OwnerDraw 属性设为 true
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
begin
if Active then
begin
Control.Canvas.Brush.Color:=clBlue;
Control.Canvas.Font.Color:=clWhite;
end
else
begin
Control.Canvas.Brush.Color:=clBtnFace;
Control.Canvas.Font.Color:=clBlack;
end;
Control.Canvas.FillRect(Rect);
Control.Canvas.TextOut(Rect.Left+3, Rect.Top+3, PageControl1.Pages[TabIndex].Caption);
end;
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
begin
if Active then
begin
Control.Canvas.Brush.Color:=clBlue;
Control.Canvas.Font.Color:=clWhite;
end
else
begin
Control.Canvas.Brush.Color:=clBtnFace;
Control.Canvas.Font.Color:=clBlack;
end;
Control.Canvas.FillRect(Rect);
Control.Canvas.TextOut(Rect.Left+3, Rect.Top+3, PageControl1.Pages[TabIndex].Caption);
end;