具有mshflexgrid控件的窗体不允许选择鼠标单击所在的行。有时,它允许选择上一行而不是被单击的行
我尝试将mshflexgrid的.RowSel属性添加为允许行选择,但不适用于第二行选择。
Private Sub MSHFlexGrid1_Click()
last_row_selected = MSHFlexGrid1.RowSel
If last_row_selected <> 1 Then last_row_selected = last_row_selected + 1
With MSHFlexGrid1
If (boolShift And vbShiftMask) = vbShiftMask Then
SelectionOneAfterTheOther
ElseIf (boolShift And vbCtrlMask) = vbCtrlMask Then
SelectUnSelectGridRow
Else
UnSelectAllGridRows
.Row = last_row_selected
.ColSel = .Cols - 1
.CellBackColor = vbHighlight
.CellForeColor = vbHighlightText
End If
End With
MSHFlexGrid1.Refresh
End Sub
.RowSel属性似乎没有为选择行选择正确的值 结果需要正确选择要单击的行。