FlexGrid for WinForms Task-Based Help > Adding ToolTips That Display UserData > UserData ToolTips for a Column |
To add ToolTips that display UserData for a column, use C1FlexGrid's MouseMove event to get the UserData property and display it in a ToolTip control.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1FlexGrid1.Cols("AtomicMass").UserData = "in atomic mass units (u)" |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1FlexGrid1.Cols["AtomicMass"].UserData = "in atomic mass units (u)"; |
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 = C1FlexGrid1.Cols(C1FlexGrid1.MouseCol).UserData 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)c1FlexGrid1.Cols[c1FlexGrid1.MouseCol].UserData; toolTip1.SetToolTip(c1FlexGrid1, tip); } |
The ToolTip appears within the entire AtomicMass column.