Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Ability to change Selected/SelectedInactive cell brush

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

Ability to change Selected/SelectedInactive cell brush
Link Posted: 25-Apr-2006 22:45
Hi,

please open up a property that allows to change the default brush/color the a selected or selected inactive cell is drawn with. So, I can set a different color than the default system color.

Thanks,

Tom
Link Posted: 27-Apr-2006 06:05
But the same properties can be accessed at design and runtime:
Inactive:
FlyGrid.SelectedUnfocusedForeColor
FlyGrid.SelectedUnfocusedBackColor

Active:
FlyGrid.SelectedForeColor
FlyGrid.SelectedBackColor
Link Posted: 27-Apr-2006 08:58
oh, I hadn't noticed them before, are they new?
Also, how would you go about if you want to draw a border around the selected cell instead of setting a background color? What would be the simplest way to achieve this, considering that I'm already using a lot of derived nodes and columns?
Link Posted: 27-Apr-2006 09:48
[quote="tomfrey"]oh, I hadn't noticed them before, are they new?


No, these properties existing since v1.2

[quote="tomfrey"]
Also, how would you go about if you want to draw a border around the selected cell instead of setting a background color? What would be the simplest way to achieve this, considering that I'm already using a lot of derived nodes and columns?


Implement IStyledNode method on your node and insert borders drawing in OnBeginPaint method. You can use CoolNode from Spreadsheet sample to modify CellFormat (add Borders property) and modify OnBeginPaint to implement borders drawing.
Link Posted: 28-Apr-2006 05:39
hm, why is info.cellSelected false when I click on a cell and it becomes highlighted? How can I tell which is the active cell?
Link Posted: 03-May-2006 10:10
can you please follow up on this?
Link Posted: 03-May-2006 15:28
info.cellSelected does not mean that cell is focused.
to determine focused state of cell you can compare
info.grid.Columns.CurrentColumn and info.col.
Link Posted: 03-May-2006 22:15
? With that I compare two column indexes, how am I going to know if a cell is selected with that?
Link Posted: 11-May-2006 06:26
[c#]
public class SomeColumn : Column
{
  //
  //....
  //
  protected virtual void PaintTextInCell(CellDrawInfo dci, Brush bkBrush, Color foreColor)
  {
    Columns cols = dci.grid.Columns;
    bool cellFocused = node.Selected && cols.CurrentColumn == dci.col;
    //......  
  }
}


The same info - CellDrawInfo is provided for nodes and columns custom drawing.
Link Posted: 11-May-2006 10:08
huh? 2 messages ago you said I should implement this in OnBeginPaint of my node:

\"Implement IStyledNode method on your node and insert borders drawing in OnBeginPaint method. You can use CoolNode from Spreadsheet sample to modify CellFormat (add Borders property) and modify OnBeginPaint to implement borders drawing.\"


Your code sample isn't correct either anyways, because dci.currentColumn is of type column and dci.col is int. I don't know how to get the index of currentColumn?