怎么实现用鼠标左键点击Speedbutton出现PopupMenu(注意我要左键不要右键)

chengxuejun 2003-03-07 05:10:17
怎么实现用鼠标左键点击Speedbutton出现PopupMenu(注意我要左键不要右键)
...全文
84 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
82wds 2003-03-08
  • 打赏
  • 举报
回复
还有一人不用API的
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
point:TPoint;
begin
point.X:=mouse.CursorPos.X;
point.Y:=mouse.CursorPos.Y;
ScreenToClient(point);
PopupMenu1.Popup(point.X,point.y);
end;
mycsdnid 2003-03-07
  • 打赏
  • 举报
回复
即:
procedure TForm1.SpeedButton1Click(Sender: TObject);
var pt: TPoint;
begin
speedbutton1.PopupMenu:=PopupMenu1;
GetCursorPos(pt);
speedbutton1.PopupMenu.Popup(pt.x,pt.y);
end;
mycsdnid 2003-03-07
  • 打赏
  • 举报
回复
在Speedbutton的onclick事件中写入:
speedbutton1.PopupMenu:=PopupMenu1;
speedbutton1.PopupMenu.Popup(鼠标位置x,y);
我不懂电脑 2003-03-07
  • 打赏
  • 举报
回复
PopupMenu.Popup(x, y);
chechy 2003-03-07
  • 打赏
  • 举报
回复
这很简单,算准按钮的座标位置,然后调用popupMenu1.Popup(X,Y);
sysu 2003-03-07
  • 打赏
  • 举报
回复
procedure TForm1.SpeedButton1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var pt: TPoint;
begin
if Button = mbLeft then begin
GetCursorPos(pt);
PopupMenu1.Popup(pt.X, pt.Y);
end;
end;
yzdiyu 2003-03-07
  • 打赏
  • 举报
回复
procedure TForm1.SpeedButton1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PopupMenu1.Popup(100,100);
end;

5,939

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧