Posted By

rengber on 02/06/07


Tagged

forms windows tooltip DataGrid


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

gndprx


Display a ToolTip for a DataGrid Cell


 / Published in: C#
 

URL: http://msdn2.microsoft.com/en-us/library/ms996485.aspx

Weird issue with Intellisense and the HitTestInfo class. Just type it in, it will compile.

  1. private void dataGrid1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
  2. {
  3. try
  4. {
  5. DataGrid.HitTestInfo hti = dataGrid1.HitTest(e.X,e.Y);
  6. if(hti.Type == DataGrid.HitTestType.Cell)
  7. {
  8. toolTip1.SetToolTip(dataGrid1, dataGrid1[hti.Row, hti.Column].ToString());
  9. }
  10. }
  11. catch{}
  12. }

Report this snippet  

You need to login to post a comment.