Handle the treeview’s mousedown event, and if it is the right-click, then explicitly set focus to th enode under the click.
private void treeView1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
treeView1.SelectedNode = treeView1.GetNodeAt (e.X ,e.Y );
}
}
Share with