改变TPageControl的活动标签颜色
设置PageControl的owndraw属性为TRUE.
procedure TForm1.pgc1DrawTab(Control: TCustomTabControl; TabIndex: Integer;
const Rect: TRect; Active: Boolean);
var
cc: Cardinal;
tabRect: TRect;
begin
CopyRect(tabRect,Rect);
Control.Canvas.Brush.Color:= Self.color;
SetBkMode(Control.Canvas.Handle,1);
Control.Canvas.FillRect(tabRect);
cc := SetTextAlign(Control.Canvas.Handle,TA_TOP);
if(not Active) then
begin
SetTextColor(Control.Canvas.Handle,RGB(0,0,0));
Control.Canvas.TextOut(tabRect.Left+5,Rect.Top+2,TPageControl(Control).Pages[TabIndex].Caption);
end
else
begin
SetTextColor(Control.Canvas.Handle,ColorToRGB(clBlue));
Control.Canvas.TextOut(tabRect.Left+5,Rect.Top+4,TPageControl(Control).Pages[TabIndex].Caption);
end;
SetBkMode(Control.Canvas.Handle,0);
SetTextAlign(Control.Canvas.Handle,cc);
end;
http://blog.csdn.net/diligentcatrich/article/details/5573423