看看是否对你有所帮助
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
vDC: HDC;
vBrush: HBRUSH;
vCatpion: string;
vRect: TRect;
vOrgFgClr: COLORREF;
begin
vDC := Control.Canvas.Handle;
vCatpion := TPageControl(Control).Pages[TabIndex].Caption;
vRect := Rect;
vBrush := CreateSolidBrush(ColorToRGB(clBtnFace));
try
FillRect(vDC, Rect, vBrush);
if Active then
vOrgFgClr := SetTextColor(vDC, ColorToRGB(clRed))
else
vOrgFgClr := SetTextColor(vDC, ColorToRGB(clWindowText));
DrawText(vDC, PChar(vCatpion), Length(vCatpion), vRect,
DT_VCENTER or DT_CENTER or DT_SINGLELINE);
SetTextColor(vDC, vOrgFgClr);
finally
DeleteObject(vBrush);
end;
end;