예제 #1
0
 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();
             }
         }
     }
 }
예제 #2
0
 protected override void OnDoubleClick(EventArgs e)
 {
     base.OnDoubleClick(e);
     if (this.SelectedRows.Count == 1)
     {
         TreeGridNode node = (TreeGridNode)this.SelectedRows[0];
         if (node.IsExpanded)
         {
             node.Collapse();
         }
         else
         {
             node.Expand();
         }
     }
 }