Dave

Dave

  • NA
  • 161
  • 0

Changing a Cursor and DataGridviewCell events.

Nov 13 2009 11:44 PM
Hi,
I am having trouble controlling my cursor behaviour on a forms app. I refer to this pic of part of a DataGridView.
My aim - for the cursor to change to a hand when it is over the trash or edit pics.

I have handled the following events:
         private void dgvBookLibrary_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
switch (dgvBookLibrary.Columns[e.ColumnIndex].Name)
{
case "ColumnDelete":
case "ColumnAmend": this.Cursor = Cursors.Hand; break;
default: break;
}
}

private void dgvBookLibrary_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
switch (dgvBookLibrary.Columns[e.ColumnIndex].Name)
{
case "ColumnDelete":
case "ColumnAmend": this.Cursor = Cursors.Arrow; break;
default: break;
}
}

They work so long as I do not roll over one of the hyperlinks in the grid. As soon as I roll over a hyperlink, the cursor remains an arrow, even when I roll over the two pics.

Any ideas?

Answers (4)