码迷,mamicode.com
首页 > 其他好文 > 详细

TreeList属性设置以及右键菜单实现

时间:2018-11-19 17:20:49      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:sign   关闭   for   tar   position   名称   point   popup   菜单栏   

AllowSort = False,//关闭排序

AllowEdit = False//不能编辑

--------右键菜单实现

 

添加右键流程:

1.先在窗体上拖两个控件,分别是popupMenu和barManager

2.barManager中绑定form属性为当前窗体名称

3.点击barManager右键选择customize,可直接添加子菜单,如果需要有工具栏、菜单栏、状态栏、怎选择Designer,可添加,然后在选择customize,添加command命令,再command选中菜单中执行命令

4.绑定右键菜单事件:在MouseDown事件中处理事件

--右键菜单出现的位置

private void tlstEquipment_MouseClick(object sender, MouseEventArgs e)
  {if (e.Button == MouseButtons.Right)
       {
           System.Drawing.Point p = new System.Drawing.Point(MousePosition.X, MousePosition.Y);
           popupMenuTree.ShowPopup(p);
        }
       }
}

TreeList属性设置以及右键菜单实现

标签:sign   关闭   for   tar   position   名称   point   popup   菜单栏   

原文地址:https://www.cnblogs.com/yourSixUncle/p/9983631.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!