我的TreeView是从数据库中取数据然后动态加的,我现在想要某个树节点上的单击事件,该怎么写。

解决方案 »

  1.   

    private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
    这个不就可以认为是节点上的单击事件么?
      

  2.   

    //像楼上说的就可以满足一般的需要了//为TreeView添加单击事件,可以通过设置属性,也可以通过代码
    this.treeView2.Click += new System.EventHandler(this.treeView2_Click);
    private void treeView2_Click(object sender, System.EventArgs e)
    {
    }
    //要在单击是得到选中的node,参考
    http://community.csdn.net/Expert/topic/5224/5224826.xml?temp=.0938074
      

  3.   

    How do I programmatically select a node in a TreeView control?
    http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c91c.aspx#q1092q