首页  编辑  

TreeView单击编辑节点

Tags: /C#/界面处理/ListView_TreeView/   Date Created:

//Node

//

//

//

private void timer1_Tick( object sender , EventArgs e)

{

   (( Timer )sender) . Enabled = false ;

    if (treeView1 . SelectedNode != null )

       treeView1 . SelectedNode . BeginEdit();

}

private void treeView1_NodeMouseClick( object sender , TreeNodeMouseClickEventArgs e)

{

   timer1 . Interval = 10 ;

   timer1 . Enabled = true ;

}

//

public void DoWork()

{

   Invoke( new EventHandler (DoInvoke));

}

private void DoInvoke( object sender , EventArgs e)

{

    if (nodeClick != null )

       nodeClick . BeginEdit();

}

private TreeNode nodeClick = null ;

private void treeView1_NodeMouseClick( object sender , TreeNodeMouseClickEventArgs e)

{

   nodeClick = e . Node;

    new System . Threading . Thread ( new System . Threading . ThreadStart (DoWork)) . Start();

}