I am trying to make it so that when the user mouses over a row in my DataGrid / dataview, each row would display a different tooltip outcome.
I cannot really figure this out. with DataGrid how can I say mouseOver on each row and give row specific data? seems like all my usual online sources have turned up nothing!
not if there is a way to make this work with a datagridview I don't know how to populate it(datagridview) as my table varies in length every time the program runs. (the program keeps track of signals, so if more signals are recieved then the table has more rows...)
* note: this is visual C# 2.0 in visual studios 2005 enviroment.
* ended up with following:
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;
prop = datagridSignal.PointToClient(prop);
myHitTest = datagridSignal.HitTest(prop.X, prop.Y);
this.toolTip.SetToolTip(datagridSignal, " ID = '" + (int)dv[myHitTest.Row][0] + "' ");
}
Why don't you handle MouseMove event on the grid? You can then transform coordinates of the mouse to the row handle and change grid's tooltip accordingly.
Something like:
private void dataGrid_MouseMove(object sender, MouseEventArgs e) {
var point = dataGrid.PointToClient(e.X, e.Y);
var hittest = dataGrid.HitTest(point.X, point.Y);
toolTip1.SetToolTip(dataGrid, hittest.Row); // add Tooltip conotrol to the form!!!
}