stringgrid当鼠标不点在cell(stringgrid中)中,就不显示弹出菜单

aiq 2009-09-22 04:55:02
stringgrid我在属性里关联了一个popmenu,要求是:当鼠标在cell范围里右键,才出现弹出菜单,在cell范围之外(stringgrid范围中)右键,不出现
...全文
105 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
aiq 2009-09-22
  • 打赏
  • 举报
回复
真是高手哦,谢谢,解决了
wzzwwz 2009-09-22
  • 打赏
  • 举报
回复
放一个 TApplicationEvents,使用他的 OnMessage

procedure TForm3.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
var
Cell: TGridCoord;
MousePos: TPoint;
begin
if (Msg.hwnd = sg1.Handle) and (Msg.message = WM_RBUTTONUP) then
begin
MousePos.X := Msg.lParam and $0000FFFF;
MousePos.Y := Msg.lParam and $FFFF0000 shr 16;
Cell := sg1.MouseCoord(MousePos.X, MousePos.Y);
if (Cell.X <> -1) and (Cell.Y <> -1) then
begin
GetCursorPos(MousePos);
pm1.Popup(MousePos.X, MousePos.Y);
end;
end;
end;
aiq 2009-09-22
  • 打赏
  • 举报
回复
fixed范围内也算(其他fixed我隐掉了),表格之外,但在stringgrid中也是的
tgbd 2009-09-22
  • 打赏
  • 举报
回复
楼主是不是指鼠标点在fixed范围内,则不出现右键菜单么?

5,927

社区成员

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

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