1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
r: TRect;
s: string;
begin
// Propriété OwnerDraw doit être à True du PageCotrol
s := PageControl1.Pages[TabIndex].Caption;
with Control.Canvas do
begin
if Active then
Brush.Color := clRed
else Brush.Color := clBtnFace;
Brush.Style := bsSolid;
FillRect(Rect);
r := Rect;
DrawText(Handle, PAnsiChar(s), Length(s), r, DT_CENTER + DT_NOPREFIX +
DT_SINGLELINE + DT_VCENTER);
end;
end; |
Partager