FlexGrid for WinForms Task-Based Help > Adding ToolTips That Display UserData > UserData ToolTips for a Single Cell |
To add ToolTips that display UserData for a single cell, use C1FlexGrid's MouseMove event to get the UserData and display it in a ToolTip control.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1FlexGrid1.SetUserData(1, "Element", "Hydrogen is a highly flammable gas.") |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1FlexGrid1.SetUserData(1, "Element", "Hydrogen is a highly flammable gas."); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub C1FlexGrid1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1FlexGrid1.MouseMove Dim tip As String tip = Me.C1FlexGrid1.GetUserData(C1FlexGrid1.MouseRow, C1FlexGrid1.MouseCol) ToolTip1.SetToolTip(C1FlexGrid1, tip) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void c1FlexGrid1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { string tip; tip = (string)this.c1FlexGrid1.GetUserData(c1FlexGrid1.MouseRow, c1FlexGrid1.MouseCol); toolTip1.SetToolTip(c1FlexGrid1, tip); } |
When the mouse moves over the first row in the Element column, the information about Hydrogen appears.