Anyone know how to get a tooltip on each row of a datagrid ? The tooltip
text must be configured depending on the row that the mouse is hovering
over, and the hover timer must be reset when the user is moving the mouse
over the rows of the grid (but not necessarily moving off the grid).

No matter what I try I cannot get this to work ! Not using the grid's
tooltip property anyway, but perhaps there is a better way.

Re: Datagrid row-specific tooltips by otabekhm

otabekhm
Mon Apr 04 10:48:11 CDT 2005

Hi,
I never dealed with tooltip, but I think you have to find row in
mouseHover event handler by hittest:
private void dataGrid_hover(object sender,
System.Windows.Forms.MouseEventArgs e)
{
DataGrid dataGrid = (DataGrid)sender;
Point hitPoint = new Point(e.X,e.Y);
int rowIndex = dataGrid.HitTest(hitPoint).Row;
//... change tooltip
text here depending on rowIndex
// then reset mouse
event args to be able to raise hover event again
}
to reset mouse event args you have to inherit from datagrid and call
base.ResetMouseEventArgs();
Hope it will be helpful,

Otabek


Re: Datagrid row-specific tooltips by JezB

JezB
Wed Apr 13 09:06:37 CDT 2005

Oh, thanks for replying, I got it working before I checked back here.

<otabekhm@gmail.com> wrote in message
news:1112629691.867992.266380@g14g2000cwa.googlegroups.com...
> Hi,
> I never dealed with tooltip, but I think you have to find row in
> mouseHover event handler by hittest:
> private void dataGrid_hover(object sender,
> System.Windows.Forms.MouseEventArgs e)
> {
> DataGrid dataGrid = (DataGrid)sender;
> Point hitPoint = new Point(e.X,e.Y);
> int rowIndex = dataGrid.HitTest(hitPoint).Row;
> //... change tooltip
> text here depending on rowIndex
> // then reset mouse
> event args to be able to raise hover event again
> }
> to reset mouse event args you have to inherit from datagrid and call
> base.ResetMouseEventArgs();
> Hope it will be helpful,
>
> Otabek
>