hMailServer.Administrator.ucIMAPFolders.treeFolders_MouseUp C# (CSharp) Method

treeFolders_MouseUp() private method

private treeFolders_MouseUp ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
return void
        private void treeFolders_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
             {
            TreeViewHitTestInfo hitTest = treeFolders.HitTest(e.Location);

            // Determine whether we should display a context menu or not.
            TreeNode currentNode = hitTest.Node;

            // Save the current folder before we switch to the new one..
            SaveCurrentFolder();

            // Switch to the new node. We do this to make sure that the
            // event handler can refresh the tree properly.
            treeFolders.SelectedNode = currentNode;

            // Display the context menu.
            contextMenuStrip.Show(treeFolders.PointToScreen(e.Location));
             }
        }