protected override void OnMouseDown(DataGridViewCellMouseEventArgs e) { if (e.Location.X > this.InheritedStyle.Padding.Left) { base.OnMouseDown(e); } else { // Expand the node //TODO: Calculate more precise location TreeGridNode node = this.OwningNode; if (node != null) { node._grid._inExpandCollapseMouseCapture = true; if (node.IsExpanded) { node.Collapse(); } else { node.Expand(); } } } }
private void expandNode(TreeGridNode node) { if (node.Nodes.Count > 0) { node.Expand(); foreach (TreeGridNode subNode in node.Nodes) { expandNode(subNode); } } }