void treeListObj_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { DevExpress.XtraTreeList.TreeList tree = ((DevExpress.XtraTreeList.TreeList)sender); Point p = new Point(e.X, e.Y); //获取到鼠标点击的坐标位置 TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location); if (hitInfo.HitInfoType == HitInfoType.Cell) { tree.SetFocusedNode(hitInfo.Node); //这句话就是关键,用于选中节点 //显示模块 showModule(hitInfo.Node.GetDisplayText(0), true); } }
private void tlTestG_MouseClick(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList tree = ((DevExpress.XtraTreeList.TreeList)sender); Point p = new Point(Cursor.Position.X, Cursor.Position.Y); //获取到鼠标点击的坐标位置 TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location); if (hitInfo.HitInfoType == HitInfoType.Cell) { tree.SetFocusedNode(hitInfo.Node); //这句话就是关键,用于选中节点 //显示模块 if (nbcLeftTree.ActiveGroup != null) { showModule(nbcLeftTree.ActiveGroup.Caption + "xxxx" + hitInfo.Node.GetDisplayText(0), true); } } }