FlexGrid for WinForms
Step 5 of 5: Implement ToolTips
Show AllShow All
Hide AllHide All

To conclude this tutorial, we will add ToolTips to the outline. The ToolTips will display the text that was stored in each row's UserDataproperty by the GetXMLDataroutine described above. The ToolTips will show the contents of the "Name" node when the user moves the mouse over its parent node. This is useful when the parent node is collapsed and the "Name" node is not visible.

  1. Add a ToolTipcontrol to the form.
  2. Add the following code to handle the grid's MouseMoveevent:

    To write code in Visual Basic

    To write code in C#

Run the program and observe the following:

The code starts by checking the cell under the mouse using the MouseRow and MouseCol properties. If the mouse is over the first column on a row that contains text for the ToolTip, it retrieves the text. Otherwise, the ToolTip text is set to Nothing.


Then the routine compares the new and current ToolTip text, and updates the text if necessary, by calling the SetToolTip method on the ToolTip control.

This concludes this tutorial. You can extend this project in many ways, including saving edits back into the XML document, adding, deleting, and moving nodes, using different styles for different types of data, and so on.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback