设置TabControl的OwnerDraw属性为True,在它的OnDrawTab事件中:
procedure TForm1.TabControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
begin
with TabControl1.Canvas do begin
if Active then
Brush.Color := clRed;
FillRect(Rect);
if Active then
TextOut(Rect.Left+5, Rect.Top+5, TabControl1.Tabs[TabIndex])
else
TextOut(Rect.Left+3, Rect.Top+3, TabControl1.Tabs[TabIndex]);
end;
end;
if PageControl1.ActivePageIndex = 0 then
.......................................
if PageControl1.ActivePageIndex = 1 then
.......................................