Example #1
0
 protected override void OnNodeMouseClick(System.Windows.Forms.TreeNodeMouseClickEventArgs e)
 {
     base.OnNodeMouseClick(e);
     System.Windows.Forms.TreeViewHitTestInfo info = HitTest(e.X, e.Y);
     if (info == null || info.Location != System.Windows.Forms.TreeViewHitTestLocations.StateImage)
     {
         return;
     }
     ToggleNodeState(e.Node);
 }
        // <summary>
        // Called when node is clicked by the mouse.  Does nothing unless the image was clicked
        // Invokes OnAfterCheck to do the real work
        // </summary>
        protected override void OnNodeMouseClick(System.Windows.Forms.TreeNodeMouseClickEventArgs e)
        {
            base.OnNodeMouseClick(e);

            // is the click on the checkbox?  If not, discard it
            System.Windows.Forms.TreeViewHitTestInfo info = HitTest(e.X, e.Y);
            if (info == null || info.Location != System.Windows.Forms.TreeViewHitTestLocations.StateImage)
            {
                return;
            }

            // toggle the node's checked status.  This will then fire OnAfterCheck
            System.Windows.Forms.TreeNode tn = e.Node;
            tn.Checked = !tn.Checked;
        }
        protected override void OnNodeMouseClick(System.Windows.Forms.TreeNodeMouseClickEventArgs e)
        {
            base.OnNodeMouseClick(e);

            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                return;
            }
            System.Windows.Forms.TreeViewHitTestInfo info = HitTest(e.X, e.Y);
            if (info == null || info.Location != System.Windows.Forms.TreeViewHitTestLocations.StateImage)
            {
                return;
            }

            System.Windows.Forms.TreeNode tn = e.Node;
            tn.Checked = !tn.Checked;
        }