gpt4 book ai didi

delphi - 使用TActionToolBar中的拆分按钮修改“箭头”

转载 作者:行者123 更新时间:2023-12-03 18:37:42 27 4
gpt4 key购买 nike

我有一个使用TActionToolBar和TActionManager的工具栏。一个按钮具有子按钮,这些子按钮可通过单击按钮右侧的向下小箭头来使用。

“向下箭头”按钮的宽度非常薄,需要精确的鼠标控制。如何自定义?

谢谢

最佳答案

一种解决方案是使用TActionToolBar的OnGetControlClass事件。

在此之前,有必要从TThemedDropDownButton派生一个类并重写GetDropDownButtonWidth函数:

function TThemedDropDownButtonEx.GetDropDownButtonWidth: Integer;
begin
Result := 14; // default drop down button width
end;


然后,在OnGetControlClass函数中:

void __fastcall TWorkAreaToolBarFrame::ActionToolBarLeftGetControlClass(TCustomActionBar *Sender,
TActionClient *AnItem, TCustomActionControlClass &ControlClass)
{
if(ControlClass == __classid(TThemedDropDownButton))
ControlClass = __classid(TThemedDropDownButtonEx);
}


简而言之,在GetControlClass事件中,工具栏允许您定义要使用的按钮类。我们使用默认宽度已更改的自定义类。

关于delphi - 使用TActionToolBar中的拆分按钮修改“箭头”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13412160/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com