private void treeList1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                DevExpress.XtraTreeList.TreeListHitInfo hitInfo = (sender as DevExpress.XtraTreeList.TreeList).CalcHitInfo(new Point(e.X, e.Y));
                treeList1.Selection.Set(hitInfo.Node);//multiselect==true时才可用
                treeList1.FocusedNode = hitInfo.Node;                DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.treeList1.CalcHitInfo(new Point(e.X, e.Y));
                if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了
                {
                    if (hInfo.Node.RootNode.Id == hInfo.Node.Id) //说明是根节点 站点
                        contextMenuStrip1.Show(this,this.PointToClient(Control.MousePosition));
                }
            }
        }           public DataTable _sampleData2
        {
            get
            {
                DataTable dt = null;
                if (dt == null)
                {
                    dt = new DataTable();
                    dt.Columns.Add(new DataColumn("ID", typeof(int)));
                    dt.Columns.Add(new DataColumn("ParentID", typeof(int)));
                    dt.Columns.Add(new DataColumn("ClassName", typeof(string)));
                    dt.Columns.Add(new DataColumn("ClassCode", typeof(string)));
                    dt.Columns.Add(new DataColumn("Re", typeof(string)));                    GoldMap.DBLink dbLink = DBLink.DbLink;
                    GoldMap.Data.DBCommand command = new GoldMap.Data.DBCommand(dbLink.GTDJLink);
                    command.Connection = new GoldMap.Data.DBConnection(dbLink.GTDJLink);
                    try
                    {
                        command.Connection.Open();
                        command.CommandText = "select fl_yj,fl_mc,xfl_dm,bz,id from dt_tdfl555 order by id";
                        IDataReader reader = command.ExecuteReader();
                        while(reader.Read())
                        {
                            dt.Rows.Add(new object[] { reader.GetInt32(4),-1,reader.GetString(1),reader.GetValue(2).ToString(),reader.GetString(3)});
                        }
                        reader.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "异常10004");
                    }
                    finally
                    {
                        command.Connection.Close();
                    }
                }
                return dt;
            }
        }           private void InitData()
        {
            int firstid=-1;
           
            ds.Tables.Add(_sampleData2);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (ds.Tables[0].Rows[i]["ClassCode"].ToString().Length == 2)
                {
                    ds.Tables[0].Rows[i]["ParentID"] = 0;
                    firstid = Convert.ToInt32(ds.Tables[0].Rows[i]["ID"]);
                }
                else
                {
                    ds.Tables[0].Rows[i]["ParentID"] = firstid;
                }
            }
            treeList1.Styles.Clear();
            treeList1.DataSource = ds.Tables[0].DefaultView;
            treeList1.PopulateColumns();
            treeList1.ExpandAll();
            dataGridView1.DataSource = ds.Tables[0];
        }