procedureTForm1.Button1Click(Sender:TObject); var p:TPoint; begin p.X:=Button1.Left; p.y:=Button1.Top+Button1.Height; p:=Self.ClientToScreen(p); PopupMenu1.Popup(p.x,p.y); end;
同样适用窗体的Show
functionGetControlPos(frm:TForm;ctrl:TControl):TPoint; var p:TPoint; begin p.X:=ctrl.Left; p.y:=ctrl.Top+ctrl.Height; p:=frm.ClientToScreen(p); Result:=p; end;