我将 TPageControl 样式设置为平面按钮 ( tsFlatButtons
),并使用事件更改选项卡的按钮颜色OnDrawTab
。
它可以工作,但未激活的按钮有灰色(btnFace 颜色)边框!
知道如何解决这个问题吗?
procedure TForm1.PageControlDrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
AText: string;
ARect: TRect;
begin
with (Control as TPageControl).Canvas do
begin
ARect := Rect;
OffsetRect(ARect, 0, 4);
Brush.Color := COLOR1;
FillRect(Rect);
AText := TPageControl(Control).Pages[TabIndex].Caption;
with Control.Canvas do
DrawText(Control.Canvas.Handle, PChar(AText), -1,ARect, DT_CENTER or DT_SINGLELINE);
end;
end;