MSFlexGridで最初に選択した行のみを反転表示するには?

解決


とわ  2004-06-10 13:17:36  No: 113874  IP: [192.*.*.*]

MSFlexGridで任意の行を選択し、そのままマウスクリックした状態で上下に移動し
マウスクリックを解除すると複数行が反転表示されてしまいます。

このような時に最初に選択した行のみを反転表示するようにしたいのですが
どのようにしたらよろしいでしょうか?

よろしくお願いします。

編集 削除
特攻隊長まるるう  2004-06-10 13:53:07  No: 113875  IP: [192.*.*.*]

マウスの動作のみ対応してます(キーボードでは複数行選択可のまま)
例えばこんな感じ?
[VB6.0]
Option Explicit

Private mCurrentRow As Integer

Private Sub Form_Load()
    Dim i As Integer
    With Me.MSHFlexGrid1
        .Rows = 10
        .Cols = 10
        .SelectionMode = flexSelectionByRow

        For i = .FixedRows To .Rows - 1
           .TextArray(Fgi(i, 0)) = i
        Next
        For i = .FixedCols To .Cols - 1
           .TextArray(Fgi(0, i)) = i
        Next

    End With
End Sub

Function Fgi(r As Integer, c As Integer) As Integer
    Fgi = c + Me.MSHFlexGrid1.Cols * r
End Function

Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    With Me.MSHFlexGrid1
       .row = mCurrentRow
       .ColSel = .Cols - 1
    End With
End Sub

Private Sub MSHFlexGrid1_RowColChange()
    mCurrentRow = Me.MSHFlexGrid1.row
End Sub

編集 削除
特攻隊長まるるう  2004-06-10 13:55:49  No: 113876  IP: [192.*.*.*]

あ。
MSHFlexGrid1 → MSFlexGrid1  で(汗)

…同じ動作しますが、一応。

編集 削除
とわ  2004-06-10 16:39:26  No: 113877  IP: [192.*.*.*]

ありがとうございます。
解決しました。

すごく早いですね。
感謝です!!

編集 削除