您的位置:首页 > 运维架构 > Shell

ShellListView切换PopMenu的具体操作方法

2015-03-22 11:33 239 查看

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

代码如下:

procedure TFormSystemTree.lvMainMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
p:Tpoint;
begin
if button=mbRight then
begin
GetCursorPos(P);
if lvMain.InnerListView.ItemIndex = -1 then
begin

lvMain.PopupMenu := PopupMenu2 ;
PopupMenu2.Popup(p.x,p.y);

end
else
begin

lvMain.PopupMenu := PopupMenu3;
PopupMenu3.Popup(p.x,p.y);

end;
end;
end;


OnPopup()事件代码如下:

procedure TFormSystemTree.PopupMenu2Popup(Sender: TObject);
begin
lvMain.PopupMenu := nil ;
end;

procedure TFormSystemTree.PopupMenu3Popup(Sender: TObject);
begin
lvMain.PopupMenu :=nil ;
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: