• abraXus
  • Advanced Member Topic Starter
Title is a little confusing, but i would like to change the back color of the top left cell which is part of the grid Header and part of the grid RowHeader as seen in the picture, without also changing the back color of the rest of the header:


To illustrate this in code:

        IGrid1.RowHeader.Appearance = iGControlPaintAppearance.StyleFlat
        IGrid1.RowHeader.Visible = True

        IGrid1.RowHeader.UseXPStyles = False

        IGrid1.Cols.Count = 2
        IGrid1.Rows.Count = 2

        IGrid1.Header.Cells(0, 0).BackColor = Color.Green
        IGrid1.RowHeader.BackColor = Color.LightBlue
        IGrid1.Cells(0, 0).BackColor = Color.Blue

        ' no error, but also no visible effect
        IGrid1.Header.Cells(0, -1).BackColor = Color.Yellow
        ' console shows that it was set correctly
        Console.WriteLine("Header Top Left Cell: " & IGrid1.Header.Cells(0, -1).BackColor.ToString)
        Console.WriteLine("Header: " & IGrid1.Header.BackColor.ToString)

My Console Output:

Header Top Left Cell: Color [Yellow]
Header: Color [Control]

According to the console, using -1 will allow me to set the back color, but it does not render as yellow. Is there something I am missing?

The special column index -1 is used in some members of iGrid to access the row text column. The column header of this column may become visible in some cases - for example, when you group iGrid by the values from the row text column:
Thus, your setting
IGrid1.Header.Cells(0, -1).BackColor = Color.Yellow
will change the background color of the column header for the row text column in the group box. Thus, your approach can't be used to implement what you need.

Unfortunately, the current version of iGrid does not provide you with an easy tool to set the color of the column header for the row header area in one statement and we need to introduce a new member for that. We could think about a temporarily solution like using another special column index like -2 to help you to implement what you need in the current release and then transfer this functionality into a public property in the next major/minor update.
  • abraXus
  • Advanced Member Topic Starter
That sounds good.

I was not aware that -1 was already used as some special case.

If -2 can be used (after you make any changes you would need to make) instead without causing any problems elsewhere, I would consider that a solution.