mardi 22 septembre 2015

Main Parent not showing checkbox in treeview

I am using CodeProject class to add tri state treeview for file/folder but every time I run this, It shows me only checkboxes on child node, not on the main parent nodes. Let's say I have C and D drive and each drive have users and windows folder, when i run my program it show me checkboxes on users and windows folder but when i check on the users or windows folder checkbox then a checkbox automatically appear on the following parent C.

protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e)
    {
        base.OnNodeMouseClick(e);

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

        // toggle the node's checked status.  This will then fire OnAfterCheck
        TreeNode tn = e.Node;
        tn.Checked = !tn.Checked;
    }

I have tried to debug this issue but unable to do this. But I am giving you the specific method that is checking that a checkbox is checked or not.




Aucun commentaire:

Enregistrer un commentaire