我为带有 TAction 列表的 TActionClientItem 创建了一个下拉菜单。我想知道如何挂钩菜单的绘图事件或内部的每个 TAction 以不同的方式显示这些 TAction 的标题!?像 TAction.OnDrawItem 或 TActionClientItem .OnDrawItem ...
procedure xxxxx.BuildActionMenu;
var
iLoop : Integer;
oItem : TAction;
oClientItem : TActionClientItem;
begin
if Assigned(oClientItem) then
for iLoop := oClientItem.Items.Count - 1 downto 0 do
oClientItem.Items.Delete(iLoop);
for iLoop := 0 to List.Count - 1 do
begin
oItem := TAction.Create(actionList);
oItem.Caption := List[iLoop].Name;
oItem.Tag := iLoop;
oItem.OnExecute := HandleOnExecuteMenuItem;
**oItem.OnDraw = WhateverFunction**
oClientItem .Items.Add.Action := oItem;
end;
if Assigned(oClientItem) then
begin
if oClientItem.CommandProperties is TButtonProperties then
TButtonProperties(oClientItem.CommandProperties).ButtonType := btSplit;
TAction(oClientItem.Action).OnExecute := HandleOnExecuteParentItem;
**oClientItem.OnDraw = WhateverFunction**
end;
end;
干杯。