VB 中怎么使MSHFlexGrid1只能被选中一行
1个回答
展开全部
还不如直接改用LISTVIEW
你小子没有结贴的习惯啊?
Private Sub Form_Load()
MSFlexGrid1.Cols = 10
MSFlexGrid1.Rows = 10
MSFlexGrid1.FixedCols = 0
MSFlexGrid1.FixedRows = 0
End Sub
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
x = MSFlexGrid1.Row
For j = 0 To MSFlexGrid1.Rows - 1
MSFlexGrid1.Row = j
For i = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = i
MSFlexGrid1.CellBackColor = vbWhite
Next i
Next j
MSFlexGrid1.Row = x
If MSFlexGrid1.CellBackColor = &H80C0FF Then
For i_Col = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = i_Col
MSFlexGrid1.CellBackColor = vbWhite
Next i_Col
Else
For i_Col = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = i_Col
MSFlexGrid1.CellBackColor = &H80C0FF
Next i_Col
End If
End Sub
你小子没有结贴的习惯啊?
Private Sub Form_Load()
MSFlexGrid1.Cols = 10
MSFlexGrid1.Rows = 10
MSFlexGrid1.FixedCols = 0
MSFlexGrid1.FixedRows = 0
End Sub
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
x = MSFlexGrid1.Row
For j = 0 To MSFlexGrid1.Rows - 1
MSFlexGrid1.Row = j
For i = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = i
MSFlexGrid1.CellBackColor = vbWhite
Next i
Next j
MSFlexGrid1.Row = x
If MSFlexGrid1.CellBackColor = &H80C0FF Then
For i_Col = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = i_Col
MSFlexGrid1.CellBackColor = vbWhite
Next i_Col
Else
For i_Col = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = i_Col
MSFlexGrid1.CellBackColor = &H80C0FF
Next i_Col
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询