Dundas Chart for Windows Forms
Text Property
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > ToolTipEventArgs Class : Text Property


Gets the tooltip of the chart element the mouse cursor is resting over (if any), and also sets the tooltip of the chart element.
The text which is going to be displayed as a Tool Tip.

Syntax

Visual Basic (Declaration)  
Public Property Text As String
Visual Basic (Usage) Copy Code
Dim instance As ToolTipEventArgs
Dim value As String
 
instance.Text = value
 
value = instance.Text
C#  
public string Text {get; set;}

Return Value

Represents the tooltip text of the element the GetToolTipText event was raised for.

Example

We use this event to provide tooltip text for a scrollbar thumb, which is associated with the primary X axis in a chart area named "Default".
C# Copy Code
using Dundas.Charting.WinControl;
...
// NOTE: Add events In C# using the Properties window so that the Event handler code Is added correctly
Private void chart1_GetToolTipText(Object sender, Dundas.Charting.WinControl.ToolTipEventArgs e)
{
   
// Check For scrolling thumb
   
If(e.HitTestResult.ChartElementType == ChartElementType.SBThumbTracker)
   {
       
// Check For chart area Object
       
If(e.HitTestResult.ChartArea.Name == "Default")
       {
           
// Check For axis Type
           
If(e.HitTestResult.Axis.Type == AxisName.X)
           {
               
// We have the right scrolling thumb, Set tooltip text
               
e.Text = "Scrolling thumb text";
           }
       }
   }
}
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...
Private Sub chart1_GetToolTipText(ByVal sender As Object, ByVal e As Dundas.Charting.WinControl.ToolTipEventArgs) _ Handles chart1.GetToolTipText

    ' Check for scrolling thumb
    If e.HitTestResult.ChartElementType = ChartElementType.SBThumbTracker Then

        ' Check for chart area object
        If e.HitTestResult.ChartArea.Name = "Default" Then

            ' Check for axis type
            If e.HitTestResult.Axis.Type = AxisName.X Then

                ' We have the right scrolling thumb, set tooltip text
                e.Text = "Scrolling thumb text"

            End If
        End If
    End If
End Sub

Remarks

This property is exposed in the GetToolTipText event of the root Chart object.

Only DataPoint, Series and LegendItem objects can have a tooltip assigned via the ToolTip and LegendToolTip properties, so getting this property will always return a zero-length string for all chart elements except series, data points and custom legend items that have a tooltip.

Use this property to:

  1. Override the tooltip of a series, data point or custom legend item.
  2. Assign a tooltip to a chart element that does not have ToolTip and LegendToolTip properties.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.