We created a simple utility class, MultiMouseListener, that permits mutliple mouse listeners to be added to the same ChartView.
The MultiMouseListener class allows multiple MouseListener objects to be attached and processed by the chart. It does that by keeping an internal list of all MouseListener objects added to it. The MultiMouseListener is itself a MouseListener and can be attached to a ChartView. Inside it forwards every mouse message that it receives to all MouseListener objects in its list. It is up to the programmer to make sure that the mouse event being trapped do not interfere with one another. An example program that includes the complete c# source of the MultiMouseListener can be downloaded here ->
http://quinn-curtis.com/examplecode/MultiMouseListenerDemo.zip
A VB version can be downloaded here (uses VS 2005 projects).
http://quinn-curtis.com/examplecode/MultiMouseListenerDemoVB.zip
In use it works like:
C#
DataToolTip datatooltip = new DataToolTip(chartVu);
datatooltip.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_XY_ONELINE);
datatooltip.SetButtonMask(MouseButtons.Left);
datatooltip.SetEnable(true);
ChartZoom zoomObj = new ChartZoom(chartVu, pTransform1, true);
zoomObj.SetButtonMask(MouseButtons.Right);
zoomObj.SetEnable(true);
MultiMouseListener multimouselistener = new MultiMouseListener(datatooltip);
multimouselistener.AddMouseListener(zoomObj);
chartVu.SetCurrentMouseListener(multimouselistener);
************************************
VB - This one hooks the tooltip to the Middle button
Dim zoomObj As New ChartZoom(chartVu, pTransform1, True)
zoomObj.SetButtonMask(System.Windows.Forms.MouseButtons.Left)
zoomObj.SetEnable(True)
Dim datatooltip As DataToolTip = New DataToolTip(chartVu)
datatooltip.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_XY_ONELINE)
datatooltip.SetButtonMask(MouseButtons.Middle)
datatooltip.SetEnable(True)
Dim multimouselistener As MultiMouseListener = New MultiMouseListener(datatooltip)
multimouselistener.AddMouseListener(zoomObj)