只有在右击节点时才会触发

private void treeList1_MouseDown(object sender, MouseEventArgs e)
         {         
 
           if (e.Button == MouseButtons.Right)
             {
                 treeList1.ContextMenuStrip = null;
 
                TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y));
                 TreeListNode node = hInfo.Node;
                 treeList1.FocusedNode = node;
                 if (node!=null)
                 {
                     treeList1.ContextMenuStrip = contextMenuStrip1;
                 }
             }
 
        }

 

相关文章:

  • 2021-09-05
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
相关资源
相似解决方案