You can grab the mouse positon (Control.MousePosition) in the MouseHover
event handler, translate the coordinates into something appropriate to the
DataGrid (dataGrid1.PointToClient()), determine the portion of the DataGrid
over which the mouse is hovering (dataGrid1.HitTest()), and then examine the
HitTestInfo that is returned to determine if the mouse is over a cell and,
if so, which cell.
private void dataGrid1_MouseHover(object sender, System.EventArgs e)
{
DataGrid grid = (DataGrid)sender;
Point clientPos = grid.PointToClient(Control.MousePosition);
DataGrid.HitTestInfo hitInfo = grid.HitTest(clientPos);
if (hitInfo.Type == DataGrid.HitTestType.Cell)
{
// this.dataGrid1[hitInfo.Row, hitInfo.Column]
}
}
--
Tim Wilson
..NET Compact Framework MVP
"melanieab" <me*******@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
Hi,
How can you determine which cell the mouse is positioned over during the
mousehover event?
Thanks so much!
Mel