VB.net,DataGridView焦点跟光标
1个回答
展开全部
代码如下:
Private Sub DataGridView1_CellMouseEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellMouseEnter
DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
Dim r As DataGridViewRow
For Each r In DataGridView1.SelectedRows
r.Selected = False
Next
If e.RowIndex > -1 Then
DataGridView1.Rows.Item(e.RowIndex).Selected = True
End If
End Sub
Private Sub DataGridView1_CellMouseEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellMouseEnter
DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
Dim r As DataGridViewRow
For Each r In DataGridView1.SelectedRows
r.Selected = False
Next
If e.RowIndex > -1 Then
DataGridView1.Rows.Item(e.RowIndex).Selected = True
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询