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); }
public void ExpandAllNodes() { VisgroupTree.ExpandAll(); }