1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Type
THackTabControl = class (ComCtrls.TTabControl)
end;
procedure TForm1.TabsDrawTab(Control: TCustomTabControl; TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
OutRect : TRect;
P: TTabControl;
TabText: string;
ImgIdx : Integer;
begin
OutRect:= Rect;
p := (Control as TTabControl) ;
TabText := THackTabControl(P).Tabs[TabIndex];
if Active Then
begin
Control.Canvas.brush.color := clblue;
Control.Canvas.FrameRect(rect);
Control.Canvas.brush.color := clBtnFace;
Control.Canvas.Font.Color := clred
end
else
begin
Control.Canvas.Brush.Color := clBtnFace;
Control.Canvas.fillrect( rect );
Control.Canvas.Font.Color := clBlack;
end;
InflateRect (OutRect, -3, -3);
ImgIdx := THackTabControl(P).GetImageIndex(TabIndex);
THackTabControl(P).Images.Draw(Control.Canvas, OutRect.Left, OutRect.Top,ImgIdx);
OutRect.Left := OutRect.Left+THackTabControl(P).Images.Width;
DrawText (Control.Canvas.Handle, PChar (ExtractFileName (TabText)), Length (ExtractFileName (TabText)), OutRect, dt_Left or dt_SingleLine or dt_VCenter);
end; |
Partager