I am using CustomDrawCellBackground and when the control loses focus, it does not redraw the background like I would expect.
To demonstrate, create a Winform with an iGrid and a text box. Add this code
Run it, click on one of the red cells (it turns blue as it's selected)
Then click on the textbox, and the cell will turn white instead of remaining red or blue.
Is there another way to do this? What am I doing wrong? (see my comments in the code to see the 2 things I have tried so far)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TextBox1.Text = Now
IGrid1.Cols.Count = 10
IGrid1.Rows.Count = 10
For Each iCell As iGCell In IGrid1.Cells
iCell.CustomDrawFlags = iGCustomDrawFlags.Background
Next
' this "fixes" it, as the cell then stays blue
' but I want it to stay the color is was previously - red, as if nothing is selected
'IGrid1.SelCellsBackColorNoFocus = IGrid1.SelCellsBackColor
'IGrid1.SelCellsForeColorNoFocus = IGrid1.SelCellsForeColor
End Sub
Private Sub ig_CustomDrawCellBackground(sender As Object, e As iGCustomDrawCellEventArgs) Handles IGrid1.CustomDrawCellBackground
e.Graphics.FillRectangle(New SolidBrush(Color.Red), e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
End Sub
Private Sub IGrid1_LostFocus(sender As Object, e As EventArgs) Handles IGrid1.LostFocus
' this fixes it, but then i cant edit the cell
' IGrid1.CurCell = Nothing
End Sub