MSHFlexGrid控件点击时可以选中多行,但有时我们需要仅仅选中一行,有一个小技巧:
Option Explicit
Private Sub Form_Load()
Dim i As Integer, j As Integer
With MSHFlexGrid1
.Rows = 10
.Cols = 4
For i = 1 To 9
.TextMatrix(i, 0) = "第 " & i & " 行"
For j = 1 To 3
.TextMatrix(0, j) = "第 " & j & " 列"
.TextMatrix(i, j) = i & "," & j
Next
Next
.SelectionMode = flexSelectionByRow
.BackColorSel = vbGreen
.ForeColorSel = vbRed
End With
End Sub
Private Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With MSHFlexGrid1
.Row = .MouseRow
.Col = 0
.ColSel = .Cols - 1
End With
End Sub
如何让MSHFlexGrid只能被选中一行&spm=1001.2101.3001.5002&articleId=92956&d=1&t=3&u=c36e2d4d633e49d8a43effb1358cbb27)
5800

被折叠的 条评论
为什么被折叠?



