Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Expand/Collapse image other than plus/minus

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Expand/Collapse image other than plus/minus
Link Posted: 30-Jul-2006 15:49
How to show a custom image for expanding/collapsing.

TIA
Michael
Link Posted: 31-Jul-2006 07:22
The nearest (today) update of FlyGrid.Net, will contain virtual HeirarchyColumn.DrawPlusMinusButton method that you can override to draw custom plus/minus buttons.
Link Posted: 31-Jul-2006 11:09
Surprise. I am quite sure I was able to use triangles as expand/collapse icons with FlyTreexPro 5 years ago , but there was no this functionality in FlyGrid.Net so far.  So currently it is just plus/minus , no other predefined images which are exposed as properties ?
Link Posted: 31-Jul-2006 21:22
FlyGrid has a lot of another possibilities - inheritance, possibility to create new column's types, wide range of custom drawing possibilities.
FlyGrid is a datagrid control instead of FlyTreeX/Pro (multiple columns tree/list), but allows to combine treeview/list functionality with datagrid functionality.
Link Posted: 01-Aug-2006 14:27
Could you give an example how to use it ( DrawPlusMinusButton ) either in demo samples or just write down several lines. Presenting +/- with different images it is quite common , strange nobody requested that so far.
Link Posted: 01-Aug-2006 15:12
Forgot to clarify in previous post. Given I go have either gifs or bmps with expand/collapse images may I use them without doing a lot of drawing by myself.
Link Posted: 02-Aug-2006 06:43
I don't this method made it into the Compiled Help File  

[quote="NineRays"]The nearest (today) update of FlyGrid.Net, will contain virtual HeirarchyColumn.DrawPlusMinusButton method that you can override to draw custom plus/minus buttons.
Link Posted: 02-Aug-2006 09:40
Unfortunately documentation hasn't been updated with a latest version of FlyGrid,
see the following code to use images to draw plus/minus buttons in HierarchyColumn inheritors:
[C#]
public class HierachyColumnWithImages : HierachyColumn
{
  private Image plusButton = null;
  [DefaultValue(null)]
  public Image PlusButton
  {
    get
    {
      return plusButton;
    }
    set
    {
      if (plusButton != value)
      {
        plusButton = value;
        base.OnChanged(InvalidationMode.ColumnWithoutHeader, false);
      }
    }
  }
  private Image minusButton = null;
  [DefaultValue(null)]
  public Image MinusButton
  {
    get
    {
      return minusButton;
    }
    set
    {
      if (minusButton != value)
      {
        minusButton = value;
        base.OnChanged(InvalidationMode.ColumnWithoutHeader, false);
      }
    }
  }
  protected override void DrawPlusMinusButton(CellDrawInfo dci, Rectangle rectangle, int xmiddle, int ymiddle)
  {
    Image button = dci.node.Expanded ?
      MinusButton != null ? MinusButton : null : PlusButton != null ? PlusButton : null;
    if (button != null)
    {
      dci.g.DrawImage(button, rectangle);
    }
    else
      base.DrawPlusMinusButton (dci, rectangle, xmiddle, ymiddle);
  }
}