We Recommend

Accelerated C# 2008 Accelerated C# 2008
This book is both a rapid tutorial and a permanent reference. You’ll quickly master C# syntax while learning how the CLR simplifies many programming tasks. You’ll also learn best practices that ensure your code will be efficient, reusable, and robust. Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way, right from the start?


Posted By

rengber on 02/06/07


Tagged

forms windows tooltip DataGrid


Versions (?)


Who likes this?

1 person has 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.