Problem after applying Alternate Row Colr of FlexGrid
Hi,
I am facing a problem after applying the Alternate Row Color Code in VB, My Flex grid do not show the Focus Rectangle. The Alternate Row Color Code is as under
Code:
Public Sub GridColors(ColorGrid As MSHFlexGrid)
For j = 0 To ColorGrid.Cols - 1
For i = 1 To ColorGrid.Rows - 1
If i Mod 2 = 1 Then
ColorGrid.Col = j
ColorGrid.Row = i
ColorGrid.CellBackColor = RGB(mRed, mGreen, mBlue)
End If
Next i
Next j
End Sub
Please help
Re: Problem after applying Alternate Row Colr of FlexGrid
I tried your code and the focus rectangle did not disappear when I ran it. Are you sure the FocusRect property isn't set to flexFocusNone?
You may optimize your For loops like this:
Code:
Option Explicit
Public Sub GridColors(ByRef ColorGrid As MSHFlexGrid)
Dim i As Long, j As Long, Color As OLE_COLOR
Color = RGB(mRed, mGreen, mBlue)
For i = 1& To ColorGrid.Rows - 1& Step 2&
ColorGrid.Row = i
For j = 0& To ColorGrid.Cols - 1&
ColorGrid.Col = j
ColorGrid.CellBackColor = Color
Next j
Next i
End Sub
Re: Problem after applying Alternate Row Colr of FlexGrid
Thanks for reply,
FocusRect is set to 2 (FlexFocusHeavy)
Secondly my Grid Settings are as under
Code:
With fgList
.Clear
.FixedCols = 0
.Rows = 1
.Cols = 2
.ColWidth(0) = 4200
.ColWidth(1) = 0
.TextMatrix(0, 0) = "Code"
.TextMatrix(0, 1) = "Description"
End With
Re: Problem after applying Alternate Row Colr of FlexGrid
When I combined your 2nd code with the 1st code, there was only 1 cell visible ("Code"). Of course, it wasn't colored.
How about you try isolating the root cause by creating a new project and copying your code there little by little. At each step, see whether the FocusRect disappears. If it does, then you know that the latest code you added is causing the problem.