private void datagridSignal_MouseMove(object sender, MouseEventArgs e)
{ this.toolTip.Hide(datagridSignal);
this.toolTip.RemoveAll();
DataTable dt = GetSignalTable();
DataView dv = new DataView(dt);
Point prop = new Point(e.X, e.Y);
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
myHitTest = datagridSignal.HitTest(prop.X, prop.Y);
this.toolTip.SetToolTip(datagridSignal, " ID = '" + (int)dv[myHitTest.Row][0] + "' '" + myHitTest.Row + "'");
}
this is my code thus far, unfortunately it isn’t providing accurate results.. for some reason it will randomly mix up the order of ID’s even though the correct index is being displayed.
***using datagrid , not datagridview
***visual C# 2.0 in Visualstudio2005 environment
EDIT:
private void dataGridSignal_MouseMove(object sender, MouseEventArgs e)
{
this.toolTip.Hide(dataGridSignal);
this.toolTip.RemoveAll();
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
myHitTest = dataGridSignal.HitTest(e.X, e.Y);
this.toolTip.SetToolTip(dataGridSignal, " ID = " + ((int)this.GetTable().Rows[myHitTest.Row][0]).ToString() + " "+ myHitTest.Row.ToString());
}
I can’t duplicate it. This worked for me:
I can only guess that the DataSource that the DataGrid is using is different than the one coming from
GetSignalTable. In my example,dtis the DataTable that my DataGrid dg is using.