如何使鼠标点击时只选中一行(不管是单击某一行还是在多行间拖动都只能有一行被选中)

解决方案 »

  1.   

    把它的SELECTIONMODE属性设成1
    然后在它的MouseMove事件中加入以下代码:
    If Button = vbLeftButton Then
     MSFlexGrid1.Row = MSFlexGrid1.RowSel
    End If
      

  2.   

    Private Sub Form_Load()
        MSFlexGrid1.Rows = 10
        MSFlexGrid1.Cols = 4
        MSFlexGrid1.SelectionMode = flexSelectionByRow
       
    End SubPrivate Sub MSFlexGrid1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        If Button = vbLeftButton Then
            MSFlexGrid1.Row = MSFlexGrid1.RowSel
        End If
    End Sub