private bool rightClickNode = false ;
private void contextMenuStrip1_Opening( object sender , CancelEventArgs e)
{
e . Cancel = ! rightClickNode;
rightClickNode = false ;
}
private void treeView1_NodeMouseClick( object sender , TreeNodeMouseClickEventArgs e)
{
if (e . Button == MouseButtons . Right)
{
(( TreeView )sender) . SelectedNode = e . Node;
rightClickNode = true ;
}
}