마우스 오른쪽 버튼 메뉴 단축키 활성화

1146 단어 delphi
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;

좋은 웹페이지 즐겨찾기