我有一个使用TActionToolBar和TActionManager的工具栏。按钮具有可用的子按钮,单击按钮右侧的向下小箭头即可。
“向下箭头”按钮的宽度非常薄,需要精确的鼠标控制。如何对其进行自定义?
谢谢
发布于 2012-11-16 19:18:36
一种解决方案是使用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事件中,工具栏允许您定义要使用的按钮类。我们使用一个改变了默认宽度的自定义类。
https://stackoverflow.com/questions/13412160
复制相似问题