日期:2014-05-18  浏览次数:21063 次

如何在C#的TreeView控件中双击节点而不改变节点的展开/折叠状态
各位如题 
谢谢各位 
b/s结构的

------解决方案--------------------
public int m_MouseClicks = 0; 
private void MouseDown(object sender, MouseEventArgs e)
{
this.m_MouseClicks = e.Clicks;
}
private void BeforeCollapse(object sender, TreeViewCancelEventArgs e)
{
if (this.m_MouseClicks > 1) 
{
e.Cancel = true;
}
else
{
e.Cancel = false;
}
}
private void BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
if (this.m_MouseClicks > 1) 

e.Cancel = true;
}
else
{
e.Cancel = false;
}
}