我想在单击按钮时显示一个弹出菜单,但是此过程在 Delphi XE 中有错误。
procedure ShowPopupMenuEx(var mb1:TMouseButton;var X:integer;var Y:integer;var pPopUP:TPopupMenu);
var
popupPoint : TPoint;
begin
if (mb1 = mbLeft) then begin
popupPoint.X := x ;
popupPoint.Y := y ;
popupPoint := ClientToScreen(popupPoint); //Error Here
pPopUP.Popup(popupPoint.X, popupPoint.Y) ;
end;
end;
procedure TForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
begin
ShowPopupMenuEx(button,Button1.Left,Button1.Top,PopupMenu1); //Error Here
end;
单击按钮时显示此错误:
[DCC 错误] Form1.pas(205): E2010 不兼容的类型: 'HWND' 和 'TPoint'
[DCC 错误] Form1.pas(398): E2197 常量对象不能作为 var 参数传递
[DCC 错误] Form1.pas( 398): E2197 常量对象不能作为 var 参数传递
单击按钮时,有没有更好的方法来显示弹出菜单?