我在程序中使用了一个 MSFlexGrid 控件显示数据库中某个表的内容。已经把此控件的 SelectionMode 属性设置为1(即按行选择),但是发现用户按住鼠标拖动时,可以选中多行内容(多条记录),请问如何才能让 MSFlexGrid 控件只选中单行呢?

解决方案 »

  1.   

    Dim MROW As Long
    Dim MCOL As LongPrivate Sub MSHFlexGrid1_Click()End SubPrivate Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
           With MSHFlexGrid1
           MROW = .MouseRow
           MCOL = .MouseCol
           End With
    End SubPrivate Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
           With MSHFlexGrid1
           .RowSel = MROW
           .ColSel = MCOL
           End With
    End Sub