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 35 36 37
| procedure TFrmStd.TabAfficheDrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
ColorBackup : TColor;
S : string;
R : TRect;
begin
S := TTabControl(Control).Tabs[TabIndex];
R := Rect;
// Dessine le canvas de la tab(Background)
with TTabControl(Control) do begin
if Active then
DrawGradientHalf(Canvas,R,True)
else begin
DrawGradientHalf(Canvas,R,False,2);
end;
// Ajout du libellé de la tab
OffsetRect(R, 2, 4);
DrawText(Canvas.Handle, PChar(S), Length(S), R, DT_CENTER or DT_VCENTER);// -> problème car pas transparent
// dessine l'arrière plan du TabControl
R := TabRect(Tabs.Count-1);
R.Left := R.Right;
R.Right := ClientWidth;
DrawGradientHalf(Canvas,R,True);
// recolore la barre sous les tabs
with Canvas do begin
Pen.Color := RGB(150,150,150);
Pen.Width := 4;
MoveTo(0,ClientHeight-3);
LineTo(ClientWidth,ClientHeight-3);
end;
end; |
Partager