I need to remove a button focus rectangle, because it looks bad over the TBitBtn
glyph after the buttons is clicked.
How to remove focus rectangle from a button control?
You can create an Interposer class for TBitBtn
and override SetButtonStyle
preventing it's internal IsFocused
variable to be set:
type
TBitBtn = class(Buttons.TBitBtn)
protected
procedure SetButtonStyle(ADefault: Boolean); override;
end;
...
implementation
procedure TBitBtn.SetButtonStyle(ADefault: Boolean);
begin
inherited SetButtonStyle(False);
end;
This will result a TBitBtn
with no focus rectangle. (Tested with D7 - with/without Theme support).
As a workaround, you can use a TSpeedButton
, which does not take the focus and, consequently, never receives a focus rectangle.
© 2022 - 2024 — McMap. All rights reserved.
Focused := false;
in the OnClick after all? – Mima