protected void checkParent(QuadCheckTreeNode qctn)
        {
            QuadCheckTreeNode pqctn = (QuadCheckTreeNode)qctn.Parent;

            if (pqctn == null)
            {
                return;
            }
            if (pqctn.checkState == QuadCheckTreeNode.CheckState.UnChecked)     // This checks a parent if it has a checked child
            {
                bool chkParent = false;
                foreach (QuadCheckTreeNode n in pqctn.Nodes)
                {
                    if (n.checkState != QuadCheckTreeNode.CheckState.UnChecked)         // Checks all the children.  If even one is checked, the parent gets checked
                    {
                        chkParent = true;
                    }
                }
                if (chkParent)
                {
                    pqctn.Checked    = true;
                    pqctn.checkState = QuadCheckTreeNode.CheckState.Checked;
                }
            }
        }
        protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e)
        {
            base.OnNodeMouseClick(e);
            TreeViewHitTestInfo tvhtInfo = HitTest(e.X, e.Y);                   // If you didn't click on it, ignore.

            if (tvhtInfo == null || tvhtInfo.Location !=
                TreeViewHitTestLocations.StateImage)
            {
                return;
            }
            QuadCheckTreeNode qctn = (QuadCheckTreeNode)e.Node;                 // If you right-clicked, set to UnChecked

            if (e.Button == MouseButtons.Right)
            {
                if (qctn.checkState != QuadCheckTreeNode.CheckState.UnChecked)
                {
                    qctn.checkState = QuadCheckTreeNode.CheckState.UnChecked;
                    qctn.Checked    = false;
                    shouldAdvance   = false;
                }
            }
            else
            {
                shouldAdvance = true;                                           // Left click sets this var==true so the node's Advance() method is called
            }
            qctn.Checked = qctn.Checked;                                        // This fires the onAfterCheck event
        }
        protected override void OnAfterCheck(TreeViewEventArgs e)
        {
            base.OnAfterCheck(e);
            if (clickStop)                                                      // This keeps the event from running if it's called inappropriately
            {
                return;
            }
            clickStop = true;
            QuadCheckTreeNode qctn = (QuadCheckTreeNode)e.Node;

            if (shouldAdvance)
            {
                qctn.checkAdvance();
                shouldAdvance        = false;
                qctn.StateImageIndex = (int)qctn.checkState;
            }
            checkParent(qctn);                                                  // Calling this method, if it actually checks a parent node, won't call onAfterCheck because of clickStop
            clickStop = false;
        }