大家好!问一个按钮弹出菜单的简单问题
大家好问一关于点击按钮弹出菜单的简单问题。
当我点击按钮,在按钮旁边就弹出一个popup菜单!可问题就是如果我的按钮是在panel面板上的,弹出的菜单没有在按钮旁边,跑到了很远的地方,改如何改呢?
为什么我把form1.left换成是panel也不行呢?
大家帮我看看!
procedure TForm1.Button1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (Button = mbLeft) then //点击鼠标弹出popup菜单?
PopupMenu1.Popup(x + Form1.Left + Button1.Left,
y + Form1.Top + Button1.Top + Button1.Height);