(1)先把 PageControl1 的 OwnerDraw 属性设为 true
(2)程序代码修改如下:
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;
本文来自博客园,作者:del88,转载请注明原文链接:https://www.cnblogs.com/del88/archive/2013/04/22/3034787.html