如何从按钮控件中删除焦点矩形? [英] How to remove focus rectangle from a button control?

查看:151
本文介绍了如何从按钮控件中删除焦点矩形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要删除按钮焦点矩形,因为在点击按钮后,它看起来比 TBitBtn 字形变坏。

I need to remove a button focus rectangle, because it looks bad over the TBitBtn glyph after the buttons is clicked.

推荐答案

您可以为 TBitBtn 创建一个Interposer类,并覆盖 SetButtonStyle 阻止其内部 IsFocused 变量设置:

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;

这将导致一个 TBitBtn 长方形。 (测试与D7 - 有/无主题支持)。

This will result a TBitBtn with no focus rectangle. (Tested with D7 - with/without Theme support).

这篇关于如何从按钮控件中删除焦点矩形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆