/// <summary>
 /// 设置当即选中树节点
 /// </summary>
 /// <param name="node">The node.</param>
 /// User:Ryan  CreateTime:2012-9-27 20:14.
 private void SetSelectedNode(TreeNodeEx node)
 {
     this.UpdateText(node);
     if (node is DefaultTreeNode)
     {
         this.SelectedNode = null;
     }
     else
     {
         this.SelectedNode = node;
         if (this.OnTreeNodeSelected != null)
         {
             TreeNodeEventArgs args = new TreeNodeEventArgs();
             args.SelectedNode = this.SelectedNode;
             this.OnTreeNodeSelected(this.PopDownTree, args);
         }
     }
 }
        /// <summary>
        /// 树节点展开处理事件
        /// </summary>
        /// <param name="sender">(控件对象).The source of the event.</param>
        /// <param name="e">(事件数据).The <see cref="System.Windows.Forms.TreeViewCancelEventArgs"/> instance containing the event data.</param>
        /// User:Ryan  CreateTime:2012-9-27 18:50.
        void PopDownTree_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            TreeNodeEx node = e.Node as TreeNodeEx;

            if (!node.LeafNode && node.Datasource == null && node.Nodes[0] != null && node.Nodes[0] is EmptyTreeNode)
            {
                //clear data
                node.LeafNode = true;
                node.Nodes.Clear();
                //实现该事件以加载子节点数据
                if (this.LoadChildNodesDataSource != null)
                {
                    TreeNodeEventArgs args = new TreeNodeEventArgs();
                    args.SelectedNode = node;
                    this.LoadChildNodesDataSource(sender, args);
                    //bind data
                    this.BindChildNode(node, args.DataSource);
                }
            }
        }