Home - Forums-.NET - FlyGrid.Net (Windows Forms) - The down arrow sign should be visible all the time.

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

The down arrow sign should be visible all the time.
Link Posted: 07-Apr-2006 00:48
Hello!

I have a flygrid that have 8 rows and two column.

If you click on any cell in the second column you get the down arrow
sign that exist for cell similar to combobox and when you click on the
down arrow the list open up so you can select a value from the list.
This works very good.

But now to my problem I want the down arrow sign to be there on the
cell all the time.
You should not have to click on the cell to be able to see the down
arrow sign.

The customer is used to see the down arrow sign all the time when the
cell are of type similar to combobox.


Many Thanks!!

//Tony
Link Posted: 09-Apr-2006 15:16
You can create DropdownColumn inheritor and override two-three procedures to implement this look:
[C#]
  public class AdvDropDownListColumn : DropDownListColumn
  {
    public AdvDropDownListColumn(string caption) : base(caption){}

    private bool showDropDownButtons = false;
    
    [DefaultValue(false)]
    public bool ShowDropDownButtons
    {
      get
      {
        return showDropDownButtons;
      }
      set
      {
        if (showDropDownButtons != value)
        {
          showDropDownButtons = value;
          base.OnChanged(InvalidationMode.ColumnWithoutHeader, false);
        }
      }
    }
    
    public override Rectangle GetEditableCellRect(FlyGridViewPort context, FlyGridViewPort grid, NodeBase node)
    {
      Rectangle er = base.GetEditableCellRect (context, grid, node);
      if (showDropDownButtons)
        er.Width -= SystemInformation.VerticalScrollBarWidth;        
      return er;
    }

    public override void PaintCell(CellDrawInfo dci)
    {
      Rectangle buttonRect = dci.cellRect;
      if (showDropDownButtons)
      {
        dci.cellRect.Width -= SystemInformation.VerticalScrollBarWidth;        
      }
      base.PaintCell (dci);
      if (showDropDownButtons)
      {
        buttonRect = new Rectangle(buttonRect.Right - SystemInformation.VerticalScrollBarWidth, buttonRect.Y, SystemInformation.VerticalScrollBarWidth, buttonRect.Height);
        ControlPaint.DrawComboButton(dci.g, buttonRect, ButtonState.Normal);
      }
    }
  }
Link Posted: 12-Jun-2006 05:34
The code you provided does indeed paint the drop arrow. However, the arrow is drawn in the classic style before I select it and drawn in the XP style after I select it. How can I get it to always be drawn in the classic style?

Additionally, I need for the control to drop down the list the first time the user clicks on the arrow. The sample requires two clicks to drop down the list.