Exemplo n.º 1
0
 private void treeList1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left && Control.ModifierKeys == Keys.None)
     {
         DevExpress.XtraTreeList.TreeList tl = sender as DevExpress.XtraTreeList.TreeList;
         dragStartHitInfo = tl.CalcHitInfo(e.Location);
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
                }
            }
        }
Exemplo n.º 4
0
        private void treeList1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList;

                DevExpress.XtraTreeList.TreeListHitInfo info = tree.CalcHitInfo(tree.PointToClient(MousePosition));
                if (info.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell)
                {
                    TreeListNode node = info.Node;

                    tree.FocusedNode = node;
                    AddLayerToMapControl(node);
                }
            }
            catch
            {
            }
        }
Exemplo n.º 5
0
        private void treeList1_MouseUp(object sender, MouseEventArgs e)
        {
            try
            {
                DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList;

                if (e.Button == MouseButtons.Right && ModifierKeys == Keys.None && tree.State == TreeListState.Regular)
                {
                    Point           ptTreeList = tree.PointToClient(MousePosition);
                    Point           pt         = Control.MousePosition;
                    TreeListHitInfo info       = tree.CalcHitInfo(ptTreeList);
                    if (info.HitInfoType == HitInfoType.Cell)
                    {
                        clickNode        = info.Node;
                        tree.FocusedNode = clickNode;
                        this.contextMenuStrip1.Show(pt);
                    }
                }
            }
            catch
            {
            }
        }