It would look something like this.
Private Class CustomToolTip
Inherits DataToolTip
Public Sub New(ByVal component As ChartView)
MyBase.New(component)
End Sub 'New
Public Overrides Sub OnDoubleClick(ByVal [me] As EventArgs)
Dim mouseevent As MouseEventArgs = DirectCast([me], MouseEventArgs)
Dim mousepos As New Point2D()
mousepos.SetLocation(mouseevent.X, mouseevent.Y)
MyBase.OnDoubleClick([me])
Dim selectedPlot As ChartPlot = DirectCast(GetSelectedPlotObj(), ChartPlot)
If selectedPlot IsNot Nothing Then
Dim selectedindex As Integer = GetNearestPoint().GetNearestPointIndex()
Dim transform As PhysicalCoordinates = GetSelectedCoordinateSystem()
End If
End Sub
End Class
You would add the class defintion to the main SPC Chart class. Using the SPCApplication1 example as a starting point, you would add it to the UserChartControl1 class
Create a public instance of it so you can access throughout the UserChartControl1 class.
Public Class UserChartControl1
Dim startTime As New ChartCalendar()
' The time increment between adjacent subgroups
Dim timeincrementminutes As Integer = 15
' Number of samples per sub group
Dim numsamplespersubgroup As Integer = 5
Dim tooltip As CustomToolTip
.
.
.
Instantiate it in the InitializeChart method
Public Sub InitializeChart()
.
.
.
' New data
SimulateData(50, 30, 15)
tooltip = New CustomToolTip(Me)
tooltip.SetEnable(True)
' Scale the y-axis of the X-Bar chart to display all data and control limits
Me.AutoScalePrimaryChartYRange()
' Scale the y-axis of the Range chart to display all data and control limits
Me.AutoScaleSecondaryChartYRange()
' Rebuild the chart using the current data and settings
Me.RebuildChartUsingCurrentData()
.
.
.
End Sub 'InitializeChart
One last thing. Override the PreDraw method for the UserChartControl1 class and call SetCurrentMouseListener there. This is needed because only the standard mouse listeners are retained after each redraw, and custom ones need to be added back in each time the chart is redrawn.
Public Overrides Sub PreDraw(ByVal g2 As Graphics)
Me.SetCurrentMouseListener(toolTip)
End Sub