ShellListView切换PopMenu的具体操作方法

来源:互联网 发布:php timestamp 格式化 编辑:程序博客网 时间:2024/06/14 12:36

需要用到ShellListView的OnMouseDown事件,PopMenu中的OnPopup()事件。其中还有如何获得PopMenu出现的坐标

代码如下:

procedure TFormSystemTree.lvMainMouseDown(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);  var  p:Tpoint;beginif button=mbRight thenbegin  GetCursorPos(P);  if lvMain.InnerListView.ItemIndex = -1 then  beginlvMain.PopupMenu := PopupMenu2 ;PopupMenu2.Popup(p.x,p.y);  end  else  beginlvMain.PopupMenu := PopupMenu3;PopupMenu3.Popup(p.x,p.y);  end;end;end;

OnPopup()事件代码如下:

procedure TFormSystemTree.PopupMenu2Popup(Sender: TObject);beginlvMain.PopupMenu := nil ;end;procedure TFormSystemTree.PopupMenu3Popup(Sender: TObject);beginlvMain.PopupMenu :=nil ;end;
0 0
原创粉丝点击