function TCustomThumbView.IsMenuKey(var Message: TWMKey): Boolean;
var
LocalPopupMenu: TPopupMenu;
begin
Result := True;
if not (csDesigning in ComponentState) then
begin
LocalPopupMenu := FAutoContextMenu;
if Assigned(LocalPopupMenu) and (LocalPopupMenu.WindowHandle <> 0) and
LocalPopupMenu.IsShortCut(Message) then Exit;
end;
Result := False;
end;
procedure TCustomThumbView.CNKeyDown(var Message: TWMKeyDown);
begin
with Message do
begin
Result := 1;
UpdateUIState(Message.CharCode);
if FAutoContextMenu.AutoPopup and IsMenuKey(Message) then Exit;
end;
inherited;
end;
procedure TCustomThumbView.CNSysKeyDown(var Message: TWMKeyDown);
begin
with Message do
begin
Result := 1;
if FAutoContextMenu.AutoPopup and IsMenuKey(Message) then Exit;
end;
inherited;
end;
procedure TCustomThumbView.DoContextPopup(MousePos: TPoint;
var Handled: Boolean);
begin
if FAutoContextMenu.AutoPopup then
begin
MousePos := ClientToScreen(MousePos);
FAutoContextMenu.Popup(MousePos.X, MousePos.Y);
Handled := True;
end
else inherited;
end;
使自定义右键菜单快捷键生效
猜你喜欢
转载自blog.csdn.net/qq_43466604/article/details/84851836
今日推荐
周排行