示例#1
0
 protected override void OnMouseDown(DataGridViewCellMouseEventArgs e)
 {
     if (e.Location.X > this.pad.Left || this.IsInEditMode)
     {
         on_name_click = true;
         base.OnMouseDown(e);
     }
     else
     {
         // Expand the node
         //TODO: Calculate more precise location
         TreeGridNode node = this.OwningNode;
         on_name_click = false;
         if (node != null && node._grid != null && node.HasChildren)
         {
             node._grid._inExpandCollapseMouseCapture = true;
             if (node.IsExpanded)
             {
                 node.Collapse();
             }
             else
             {
                 node.Expand();
             }
         }
     }
 }
 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();
             }
         }
     }
 }
示例#3
0
 protected override void OnMouseDown(DataGridViewCellMouseEventArgs e)
 {
     if (e.Location.X > this.GlyphMargin && e.Location.X < this.GlyphMargin + GLYPH_WIDTH)
     {
         TreeGridNode node = this.OwningNode;
         if (node != null)
         {
             node.Grid.inExpandCollapseMouseCapture = true;
             if (node.IsExpanded)
             {
                 node.Collapse();
             }
             else
             {
                 node.Expand();
             }
         }
     }
     else if (e.Location.X > this.GlyphMargin + GLYPH_WIDTH && e.Location.X < this.Style.Padding.Left - GLYPH_WIDTH)
     {
         // CheckBox
         this.OwningNode.IsCheckStateChangedByProgram = true;
         this.OwningNode.Checked = !this.OwningNode.Checked;
     }
     else
     {
         base.OnMouseDown(e);
     }
 }