DataGridView更改游标选中的行

时间:2013-07-09 12:03:18

标签: vb.net datagridview cursor

如何更改光标箭头。我有10列,我想在第一列上更改光标。

2 个答案:

答案 0 :(得分:1)

如果您依赖CellMouseEnter事件,您可以轻松获得所需内容。在这里,您有DataGridView1和第1列的工作代码:

Private Sub DataGridView1_CellMouseEnter(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellMouseEnter

    If (e.ColumnIndex = 0) Then
        Cursor = Cursors.Hand 'Different cursor when the mouse is over a cell belonging to column 1
    Else
        Cursor = Cursors.Default
    End If

End Sub

答案 1 :(得分:0)

如果index = firstColumn则

Cursor = Cursors.hand

ENDIF