protected override void WndProc(ref Message m)
 {
     if (m.Msg == 0x203)
     {
         Point Hitpoint            = new Point((int)(m.LParam));
         TreeViewHitTestInfo tvhti = HitTest(Hitpoint);
         if (tvhti != null && tvhti.Location == TreeViewHitTestLocations.StateImage)
         {
             this.SelectedNode = tvhti.Node;
             TreeNodeMouseClickEventArgs tvs = new TreeNodeMouseClickEventArgs(this.SelectedNode, MouseButtons.Left, 2, Hitpoint.X, Hitpoint.Y);
             MouseEventArgs mvs = new MouseEventArgs(MouseButtons.Left, 2, Hitpoint.X, Hitpoint.Y, 0);
             OnNodeMouseDoubleClick(tvs);
             OnMouseDoubleClick(mvs);
             OnDoubleClick(new EventArgs());
             m.Result = IntPtr.Zero;
             return;
         }
         else
         {
             base.WndProc(ref m);
         }
     }
     else
     {
         base.WndProc(ref m);
     }
 }
示例#2
0
        private void treeView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeViewHitTestInfo info = this.treeView1.HitTest(e.X, e.Y);

            if (info.Node == null)
            {
                return;
            }
            if (info.Node.Tag is JianLi3Data.Solution)
            {
                JianLi3Data.Solution s = (JianLi3Data.Solution)info.Node.Tag;
                // 代码重复
                if (dte.Solution.FullName == "")
                {
                    dte.Solution.Open(s.SolutionPath);
                }
                else
                {
                    System.Diagnostics.Process          p  = new System.Diagnostics.Process();
                    System.Diagnostics.ProcessStartInfo ps = new ProcessStartInfo(s.SolutionPath);
                    p.StartInfo = ps;
                    p.Start();
                }
            }
        }
示例#3
0
        /// <summary>
        /// Select or un-select the key-node
        /// if down the left mouse button in the area of check-box or label.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeViewHost_MouseDown(object sender, MouseEventArgs e)
        {
            TreeViewHitTestInfo hitInfo = treeViewHost.HitTest(e.Location);

            if (e.Button == MouseButtons.Left &&
                (hitInfo.Location == TreeViewHitTestLocations.StateImage ||
                 hitInfo.Location == TreeViewHitTestLocations.Label))
            {
                // mouse down in area of state image or label.
                TreeNode node = hitInfo.Node;
                if (node.Nodes.Count > 0)
                {
                    // cancel the expand or collapse of node which has children.
                    m_cancelExpandOrCollapse = true;
                }

                // active the node.
                ActiveNode(node);

                // select or un-select the node.
                CheckState checkState = (CheckState)((node.StateImageIndex + 1) % 2);
                UpdateNodeCheckStatus(node, checkState);

                pictureBoxPreview.Refresh();
            }
        }
示例#4
0
        //**********************************************************************************************
        private void treeServers_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                TreeViewHitTestInfo info = treeServers.HitTest(new Point(e.X, e.Y));

                bool isServer = (info.Node?.Tag is Server);
                bool isGroup  = (info.Node?.Tag is Group);

                if (isServer)
                {
                    treeServers.ContextMenuStrip = contextServer;
                }

                if (isGroup)
                {
                    treeServers.ContextMenuStrip  = contextGroup;
                    contextGroup.Items[1].Enabled = true; //rename
                    contextGroup.Items[2].Enabled = true; //delete
                }

                if (!isServer && !isGroup && tabStrip1.SelectedTab == FilterGrouped)
                {
                    treeServers.ContextMenuStrip  = contextGroup;
                    contextGroup.Items[1].Enabled = false; //rename
                    contextGroup.Items[2].Enabled = false; //delete
                }
            }
        }
示例#5
0
        private void tvFolders_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            // ignora los clicks en los controles de expandir y contraer del treeview
            TreeViewHitTestInfo hit = tvFolders.HitTest(e.Location);

            if (hit.Location != TreeViewHitTestLocations.PlusMinus)
            {
                TreeNode selectedNode = e.Node;
                selectedNode.Nodes.Clear();

                if (selectedNode.Tag.GetType() == typeof(DriveInfo))
                {
                    DriveInfo info = (DriveInfo)selectedNode.Tag;
                    GetFolders(info.RootDirectory.GetDirectories(), selectedNode);
                    GetFiles(info.RootDirectory);
                }
                else if (selectedNode.Tag.GetType() == typeof(DirectoryInfo))
                {
                    DirectoryInfo info = (DirectoryInfo)selectedNode.Tag;
                    GetFolders(info.GetDirectories(), selectedNode);
                    GetFiles(info);
                }

                selectedNode.Expand();
            }
        }
        public void TestBadLocation()
        {
            TreeViewHitTestInfo t = new TreeViewHitTestInfo(null, (TreeViewHitTestLocations)(-1));

            Assert.AreEqual(t.Node, null, "bad-loc-1");
            Assert.AreEqual((int)t.Location, -1, "bad-loc-2");
        }
示例#7
0
        private void treeView1_MouseUp(object sender, MouseEventArgs e)
        {
            TreeView            treev = sender as TreeView;
            Point               point = treev.PointToClient(Cursor.Position);
            TreeViewHitTestInfo info  = treev.HitTest(point.X, point.Y);
            TreeNode            node  = info.Node;//获得 右键点击的节点

            if (node != null)
            {
                StyleLayerNum = node.Index;
            }

            if (node != null && e.Button == MouseButtons.Right)//判断你点的是不是右键
            {
                Point    ClickPoint  = new Point(e.X, e.Y);
                TreeNode CurrentNode = treeView1.GetNodeAt(ClickPoint);
                if (CurrentNode != null)//判断你点的是不是一个节点
                {
                    CurrentNode.ContextMenuStrip = contextMenuStrip1;
                    treeView1.SelectedNode       = CurrentNode;//选中这个节点
                }
            }
            else
            {
                contextMenuStrip1.Visible = false;
            }
        }
示例#8
0
 private void m_arbreConsultation_DragOver(object sender, DragEventArgs e)
 {
     if (DragDataHasDocGed(e.Data))
     {
         if ((e.KeyState & 8) == 8)//control
         {
             e.Effect = DragDropEffects.Copy;
         }
         else
         {
             e.Effect = DragDropEffects.Move;
         }
         TreeViewHitTestInfo info = m_arbreConsultation.HitTest(m_arbreConsultation.PointToClient(new Point(e.X, e.Y)));
         if (info != null && info.Node != null && info.Node.Tag is CNodeConsultationHierarchique &&
             ((CNodeConsultationHierarchique)info.Node.Tag).ObjetLie is CObjetDonneeAIdNumerique)
         {
             HightlightElementDeArbre(info.Node);
         }
         else
         {
             HightlightElementDeArbre(null);
             e.Effect = DragDropEffects.None;
         }
     }
     else
     {
         e.Effect = DragDropEffects.None;
     }
 }
示例#9
0
        private void treeView1_MouseDown(object sender, MouseEventArgs e)
        {
            TreeViewHitTestInfo info = this.treeView1.HitTest(e.Location);

            if (info == null || info.Node == null)
            {
                this.treeView1.ContextMenuStrip = null;
                return;
            }
            IUser user = info.Node.Tag as IUser;

            if (user == null)
            {
                this.treeView1.ContextMenuStrip = null;
                return;
            }

            if (user.ID == this.currentUser.ID)
            {
                this.treeView1.ContextMenuStrip = null;
                return;
            }

            this.treeView1.SelectedNode     = info.Node;
            this.treeView1.ContextMenuStrip = this.skinContextMenuStrip_user;
        }
示例#10
0
        /// <summary>
        /// TreeView双击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void TreeViewJob_DoubleClick(object sender, MouseEventArgs e)
        {
            //判断是否在节点上双击
            object toolClass               = new object();
            string jobName                 = FormJobManage.Instance.tabJobUnion.SelectedTab.Text;
            TreeViewHitTestInfo test       = VisionJobParams.pVisionProject.Project[jobName].GetJobTree().HitTest(e.X, e.Y);
            TreeNode            selectNode = test.Node.Level == 0 ? test.Node : test.Node.Parent;

            selectNode.ExpandAll();
            for (int i = 0; i < VisionJobParams.pVisionProject.Project[jobName].L_toolList.Count; i++)
            {
                if (selectNode.Text == VisionJobParams.pVisionProject.Project[jobName].L_toolList[i].toolName)
                {
                    string AssemblyName = VisionJobParams.pVisionProject.Project[jobName].L_toolList[i].FormToolName.Split('.')[0];
                    string className    = VisionJobParams.pVisionProject.Project[jobName].L_toolList[i].FormToolName;
                    toolClass          = VisionJobParams.pVisionProject.Project[jobName].L_toolList[i];
                    IToolInfo.FormTool = (Form)Assembly.Load(AssemblyName).CreateInstance(className, false, BindingFlags.Default, null, new object[] { toolClass }, null, null);
                    IToolInfo.FormTool.ShowDialog();
                    //VisionJobParams.myProject[jobName].L_toolList[i].SetFormTool(IToolInfo.FormTool);
                    //VisionJobParams.myProject[jobName].L_toolList[i].GetFormTool().ShowDialog();
                    //VisionJobParams.myProject[jobName].L_toolList[i].FormTool = (Form)Assembly.Load(AssemblyName).CreateInstance(className, false, BindingFlags.Default, null, new object[] { toolClass }, null, null);
                    //VisionJobParams.myProject[jobName].L_toolList[i].FormTool.ShowDialog();
                }
            }
        }
示例#11
0
 //-------------------------------------------------------------------------
 private void m_arbreCategories_DragOver(object sender, DragEventArgs e)
 {
     if (DragDataHasDocGed(e.Data))
     {
         if ((e.KeyState & 8) == 8)//control
         {
             e.Effect = DragDropEffects.Copy;
         }
         else
         {
             e.Effect = DragDropEffects.Move;
         }
         TreeViewHitTestInfo info = m_arbreCategories.HitTest(m_arbreCategories.PointToClient(new Point(e.X, e.Y)));
         if (info != null && info.Node != null && m_arbreCategories.GetObjetInNode(info.Node) is CCategorieGED)
         {
             HightlightCategorie(info.Node);
         }
         else
         {
             HightlightCategorie(null);
             e.Effect = DragDropEffects.None;
         }
     }
     else
     {
         e.Effect = DragDropEffects.None;
     }
 }
示例#12
0
        private void TmpltTreeView_MouseDown(object sender, MouseEventArgs e)
        {
            TreeViewHitTestInfo testInfo = this.HitTest(e.Location);

            expandCollapse = e.Clicks > 1 && (testInfo.Location == TreeViewHitTestLocations.Label ||
                                              testInfo.Location == TreeViewHitTestLocations.Image);
        }
示例#13
0
        private void treeDriver_MouseClick(object sender, MouseEventArgs e)
        {
            var hitTest = treeDriver.HitTest(e.Location);

            if (hitTest.Location != TreeViewHitTestLocations.PlusMinus)
            {
                TreeViewHitTestInfo info = treeDriver.HitTest(treeDriver.PointToClient(Cursor.Position));
                if (info != null && info.Node.Tag != "con")
                {
                    if (thread != null && thread.IsAlive)
                    {
                        thread.Abort();
                    }
                    imglistview.Images.Clear();
                    thread = new Thread(() => showListFile(info.Node.Tag.ToString()));
                    thread.Start();
                    links.Add(info.Node.Tag.ToString());
                    index       = links.Count - 1;
                    back.Cursor = Cursors.No;
                    next.Cursor = Cursors.No;
                    if (links.Count > 1)
                    {
                        back.Cursor = Cursors.Hand;
                    }
                    //showListFile(info.Node.Tag.ToString());
                }
            }
        }
示例#14
0
        protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e)
        {
            base.OnNodeMouseClick(e);

            TreeViewHitTestInfo hitTest = HitTest(e.Location);

            if (hitTest.Node != e.Node)
            {
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                if (hitTest.Location == TreeViewHitTestLocations.Label)
                {
                    this.SelectedNode = e.Node;
                    NodeContextMenuRequested.Invoke(this, e);
                }
            }
            else if (e.Button == MouseButtons.Left)
            {
                if (hitTest.Location == TreeViewHitTestLocations.Label)
                {
                    NodeSelected.Invoke(this, new TreeViewExEventArgs(e.Node, e));
                }
            }
        }
        private void trviewDoUong_Click(object sender, EventArgs e)
        {
            List <DoUong>       ds   = new List <DoUong>();
            TreeViewHitTestInfo info = trviewDoUong.HitTest(trviewDoUong.PointToClient(Cursor.Position));

            if (info != null)
            {
                //   MessageBox.Show(info.Node.Text);
                try
                {
                    using (var k = new AppCode.QuanCafe())
                    {
                        foreach (var item in k.DSDoUong)
                        {
                            if (k.TimLoaiDU(item.IDLoai).TenLoai.ToUpper() == info.Node.Text.ToUpper())
                            {
                                ds.Add(item);
                            }
                        }
                        grvDSDoUongF.DataSource = ds;
                    }
                }
                catch
                {
                }
            }
        }
示例#16
0
        //for drag
        public TreeNode GetHoveringNode(int screen_x, int screen_y)
        {
            Point pt = PointToClient(new Point(screen_x, screen_y));
            TreeViewHitTestInfo hitInfo = HitTest(pt);

            return(hitInfo.Node);
        }
示例#17
0
        private void tv_CamList_MouseUp(object sender, MouseEventArgs e)
        {
            TreeView            treev = sender as TreeView;
            Point               point = treev.PointToClient(Cursor.Position);
            TreeViewHitTestInfo info  = treev.HitTest(point.X, point.Y);
            TreeNode            node  = info.Node;

            if (node == null)
            {
                this.tsmDelectCam.Enabled = false;
            }
            else
            {
                this.tsmDelectCam.Enabled = true;
            }

            if (node != null && MouseButtons.Right == e.Button)
            {
                treev.SelectedNode = node;//关键的一句话,右键点击菜单的时候,会选中右键点击的项
            }
            else if (node != null && MouseButtons.Left == e.Button)
            {
                CameraInfo mCameraInfo = this._TCameraInfo.getCamByName(node.Text);

                if (mCameraInfo != null)
                {
                    showCamInfo(mCameraInfo);
                }
            }
        }
示例#18
0
        public static BindableTreeNode GetContextMenuTreeviewNode(BindableTreeView treeView, object sender)
        {
            BindableTreeNode node = default(BindableTreeNode);

            if (sender is ContextMenuStrip)
            {
                ContextMenuStrip    contextMenuStrip = (ContextMenuStrip)sender;
                TreeViewHitTestInfo testInfo         = treeView.HitTest(treeView.PointToClient(new Point(contextMenuStrip.Left, contextMenuStrip.Top)));

                if (testInfo.Node != default(TreeNode))
                {
                    node = (BindableTreeNode)testInfo.Node;
                }
            }
            else if (sender is ToolStripMenuItem)
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
                node = GetContextMenuTreeviewNode(treeView, menuItem.Owner);
            }
            else if (sender is ToolStripDropDownMenu)
            {
                ToolStripDropDownMenu menu = (ToolStripDropDownMenu)sender;
                node = GetContextMenuTreeviewNode(treeView, menu.OwnerItem);
            }

            return(node);
        }
        public void TreeViewHitTestInfo_Ctor_TreeNode_TreeViewHitTestLocations(TreeNode hitNode, TreeViewHitTestLocations hitLocation)
        {
            var hitTestInfo = new TreeViewHitTestInfo(hitNode, hitLocation);

            Assert.Same(hitNode, hitTestInfo.Node);
            Assert.Equal(hitLocation, hitTestInfo.Location);
        }
示例#20
0
        private void trviewDoAn_Click(object sender, EventArgs e)
        {
            var ds = new List <Chitiethoadon>()
            {
                new Chitiethoadon()
                {
                    mathang = "tôm hùm nướng phô mai", gia = 23000, donvi = "kg"
                },
                new Chitiethoadon()
                {
                    mathang = "tôm hùm lẩu", gia = 23000, donvi = "kg"
                },
                new Chitiethoadon()
                {
                    mathang = "tôm hùm nướng mọi", gia = 23000, donvi = "kg"
                },
                new Chitiethoadon()
                {
                    mathang = "tôm hùm ăn sống", gia = 23000, donvi = "kg"
                }
            };
            TreeViewHitTestInfo info = trviewDoAn.HitTest(trviewDoAn.PointToClient(Cursor.Position));

            if (info.Node.Index == 0)
            {
                grvDSDoUongF.DataSource = ds;
            }
            btnThemMon.Enabled = true;
        }
示例#21
0
        /// <summary>
        /// get map data of treeNode depending on point
        /// </summary>
        /// <param name="pt"></param> point on tree
        /// <param name="findExact">click anywhere in the line of an item except plus/minus sign
        /// is considered as click on item</param>
        /// <returns></returns>
        internal MapData pointToMapData(Point pt, bool findExact)
        {
            Debug.Assert(Misc.IsGuiThread());
            TreeViewHitTestInfo info = _treeControl.HitTest(pt);

            if (findExact)
            {
                if (info != null)
                {
                    switch (info.Location)
                    {
                    case TreeViewHitTestLocations.Image:
                    case TreeViewHitTestLocations.Indent:
                    case TreeViewHitTestLocations.Label:
                    case TreeViewHitTestLocations.RightOfLabel:
                    case TreeViewHitTestLocations.StateImage:
                        return(controlsMap.getMapData(info.Node));

                    default:
                        break;
                    }
                }
                return(null);
            }
            else if (info != null && info.Node != null)
            {
                return(controlsMap.getMapData(info.Node));
            }
            else
            {
                return(controlsMap.getMapData(_treeControl));
            }
        }
示例#22
0
        /// <summary>
        /// Handles the mouse down event
        ///
        /// Selects the node under the mouse cursor.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            TreeViewHitTestInfo hitTestInfo = this.HitTest(e.X, e.Y);

            if (hitTestInfo.Node != null &&
                hitTestInfo.Location != TreeViewHitTestLocations.PlusMinus &&
                (hitTestInfo.Node as VSTreeNode).Enabled == true)
            {
                this.SelectedNode = hitTestInfo.Node;

                if (hitTestInfo.Node.Level == 0)
                {
                    if (hitTestInfo.Node.IsExpanded == true)
                    {
                        hitTestInfo.Node.Collapse();
                    }
                    else
                    {
                        hitTestInfo.Node.Expand();
                    }
                }
            }

            base.OnMouseDown(e);
        }
示例#23
0
        /// <summary>
        /// Opens the ContextMenu for this treelist.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void contextpop(object sender, EventArgs e)
        {
            ContextMenu.MenuItems.Clear();

            if (SelectedNode != null)
            {
                _f.SelectField();                                               // revert the editpanel
            }
            TreeViewHitTestInfo info = HitTest(PointToClient(Cursor.Position)); // NOTE: That is fullrow.

            if (info != null)
            {
                TreeNode node = info.Node;
                if (node != null)
                {
                    SelectedNode = node;

                    if (_f._extEnabled)
                    {
                        context_Extension();
                    }
                    else
                    {
                        context_Standard();
                    }
                }
                else if (Nodes.Count == 0)                 // is blank GFF - req'd.
                {
                    ContextMenu.MenuItems.Add(new MenuItem("add TopLevelStruct", contextclick_AddTopLevelStruct));
                }
            }
        }
示例#24
0
        private void treeView_DragOver(object sender, DragEventArgs e)
        {
            TreeView tv = sender as TreeView;

            if (e.Data.GetDataPresent(typeof(System.String)))
            {
                // Set the effect based upon the KeyState.
                if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy)
                {
                    e.Effect = DragDropEffects.Copy;
                }
                TreeViewHitTestInfo info = tv.HitTest(tv.PointToClient(new Point(e.X, e.Y)));
                m_DropNode = info.Node;
            }
            else if (e.Data.GetDataPresent(typeof(System.Int32)))
            {
                if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move)
                {
                    e.Effect = DragDropEffects.Move;
                }
                TreeViewHitTestInfo info = tv.HitTest(tv.PointToClient(new Point(e.X, e.Y)));
                m_DropNode = info.Node;
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
示例#25
0
        private void bookmarksTree_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetData(typeof(Bookmark)) is Bookmark bookmark)
            {
                // The mouse locations are relative to the screen, so they must be
                // converted to client coordinates.
                Point clientPoint = bookmarksTree.PointToClient(new Point(e.X, e.Y));

                // If the drag operation was a move then add the row to the other control.
                if (e.Effect == DragDropEffects.Move)
                {
                    TreeViewHitTestInfo hittest = bookmarksTree.HitTest(clientPoint.X, clientPoint.Y);
                    if (hittest.Node == null)
                    {
                        return;
                    }
                    TreeNode dropNode = hittest.Node;
                    if (!(dropNode.Tag is BookmarkFolder dropFolder))
                    {
                        return;
                    }

                    _bookmarkManager.MoveBookmark(bookmark, dropFolder.Id);
                    ReLoadBookmarks();
                }
            }
        }
示例#26
0
        //
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WM_PAINT:
                if (enablePaint)
                {
                    base.WndProc(ref m);
                }
                break;

            case WM_ERASEBKGND:
                break;

            case WM_LBUTTONDBLCLK:
                // disable double-click on checkbox to fix Microsoft Vista bug
                TreeViewHitTestInfo info = HitTest(new Point((int)m.LParam));
                if (info != null && info.Location == TreeViewHitTestLocations.StateImage)
                {
                    m.Result = IntPtr.Zero;
                }
                else
                {
                    base.WndProc(ref m);
                }
                break;

            default:
                base.WndProc(ref m);
                break;
            }
        }
        private void AETreeViewClick(object sender, EventArgs e)
        {
            MouseEventArgs      args    = (MouseEventArgs)e;
            TreeViewHitTestInfo hitTest = _aeTreeView.HitTest(args.Location);

            if (hitTest == null || hitTest.Node == null)
            {
                return;
            }

            if (hitTest.Node.StateImageIndex >= 0 && hitTest.Location == TreeViewHitTestLocations.StateImage)
            {
                if (hitTest.Node.Tag is IServerTreeGroup)
                {
                    OnServerGroupChecked(hitTest.Node);
                }
                else if (hitTest.Node.Tag is IServerTreeDicomServer)
                {
                    OnServerChecked(hitTest.Node);
                }

                _component.ServerTree.FireServerTreeUpdatedEvent();
            }

            if (hitTest.Node == _lastClickedNode)
            {
                return;
            }

            if (hitTest.Location == TreeViewHitTestLocations.Label || hitTest.Location == TreeViewHitTestLocations.Image)
            {
                SelectNode(hitTest.Node);
                _component.SetSelection(_lastClickedNode.Tag as IServerTreeNode);
            }
        }
示例#28
0
        //check if user click on the state image
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);
            if (e.Button == MouseButtons.Left)
            {
                TreeViewHitTestInfo info = base.HitTest(e.Location);
                if (info.Node != null && info.Location == TreeViewHitTestLocations.StateImage)
                {
                    TreeNode node = info.Node;
                    switch (node.StateImageIndex)
                    {
                    case STATE_UNCHECKED:
                    case STATE_MIXED:
                        node.StateImageIndex = STATE_CHECKED;
                        break;

                    case STATE_CHECKED:
                        node.StateImageIndex = STATE_UNCHECKED;
                        break;
                    }
                    UpdateChildren(node);
                    UpdateParent(node);
                }
            }
        }
示例#29
0
文件: MyTree.cs 项目: khiemnv/chatApp
        protected void OnNodeMouseClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e)
        {
            //base.OnNodeMouseClick(e);

            // is the click on the checkbox?  If not, discard it
            TreeViewHitTestInfo info = m_tree.HitTest(e.X, e.Y);

            if (info == null)
            {
                return;
            }
            else if (info.Location == TreeViewHitTestLocations.Label)
            {
                string key = (string)e.Node.Tag;

                var tNode = m_nodeDict[key];
                //var title = tNode.title;
                //if (title == null) { return; }

                //avoid re display title
                DisplayNode(tNode);
            }
            else if (info.Location == System.Windows.Forms.TreeViewHitTestLocations.StateImage)
            {
                TreeNode tn   = e.Node;
                var      bChk = Check(tn);
                Check(tn, !bChk);
            }
            else
            {
                return;
            }
        }
        private void treeView1_DragDrop(object sender, DragEventArgs e)
        {
            Point p = treeView1.PointToClient(new Point(e.X, e.Y));
            TreeViewHitTestInfo index = treeView1.HitTest(p);
            var parentnodes           = treeView1.Nodes;

            if (index.Node != null)
            {
                parentnodes = index.Node.Nodes;
            }
            for (int i = myDataGridView1.Rows.Count - 1; i >= 0; i--)
            {
                if (myDataGridView1.Rows[i].Selected)
                {
                    TreeNode node = new TreeNode(myDataGridView1.Rows[i].Cells["Name"].Value.ToString());
                    node.Tag = myDataGridView1.Rows[i].Cells["PhotoId"].Value;
                    parentnodes.Add(node);
                }
            }
            for (int i = myDataGridView1.Rows.Count - 1; i >= 0; i--)
            {
                if (myDataGridView1.Rows[i].Selected)
                {
                    myDataGridView1.Rows.RemoveAt(i);
                }
            }
        }