■87696 / ) |
DataGridViewの複数行の選択 |
□投稿者/ 太麺 (1回)-(2018/06/20(Wed) 18:23:19)
|
分類:[.NET 全般]
開発環境:Windows7 32bit Visual Studio2010 .NET Frame work4.7
お世話になっております。
DataGridViewでCtrlキーを押さなくてもクリックだけでセルを複数行選択できるようにコードを書いたのですが
Private Sub DataGridView1_CellMouseUp(ByVal sender As Object, ByVal e As DataGridViewCellMouseEventArgs) Handles DataGridView2.CellMouseUp
Dim selectedCells As DataGridViewSelectedCellCollection = DataGridView2.SelectedCells
For Each cell As DataGridViewCell In selectedCells
If cellCollection.Contains(cell) Then
cellCollection.Remove(cell)
cell.Selected = False
Else
cellCollection.Add(cell)
End If
Next
For Each cell As DataGridViewCell In cellCollection
cell.Selected = True
Next
End Sub
やりたいこと自体は出来ているのですがセルをクリックするたびに既に選択状態のセルがちらつきます。
ちらつかないようにする方法はありますか?ダブルバッファリングを有効にしてみましたがうまくいきませんでした。
SelectionModeプロパティはFullRowSelect、MultiSelecプロパティtはTrueになっています。
|
|