Beispiel #1
0
        private void NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (!ShowCheckboxes)
            {
                return;
            }

            // Only do something if the click is over the image (checkbox)
            var hit = VisgroupTree.HitTest(e.X, e.Y);

            if (hit.Location != TreeViewHitTestLocations.StateImage)
            {
                return;
            }

            var disabled = e.Node.StateImageKey.EndsWith("Disabled");

            if (disabled)
            {
                return;
            }

            var id = (int)e.Node.Tag;
            // unchecked -> checked, checked -> unchecked, mixed -> unchecked
            var visible = e.Node.StateImageKey.StartsWith("Unchecked");

            e.Node.StateImageKey = (visible ? "Checked" : "Unchecked");
            OnVisgroupToggled(id, visible ? CheckState.Checked : CheckState.Unchecked);
        }
Beispiel #2
0
 public void ExpandAllNodes()
 {
     VisgroupTree.ExpandAll();
 }