0
点赞
收藏
分享

微信扫一扫

WinForm——ContextMenuStrip总结

田妞的读书笔记 2022-03-20 阅读 57
c#右键edn


  1. 使用举例

根据属的节点层次不同,右键列表的内容显示不同。

需要使用Opening事件。

private void contextMenuStrip1_Opening(object sender,CancelEventArgs e)

{

         TreeNode node=trw.SelectedNode;

         if (node==null)

{

         return;

}

Point p=tvw.PointToScreen(trw.Loction);

int y=node.Bounds.Y;

if (y<0||y>trv.Height)

{

         return;

}

if (node.Level>=1)

{

         contextMenuStrip1[“NewDish”].Visible=false;

         contextMenuStrip1[“Istart”].Visible=false;

}

}


举报

相关推荐

0 条评论