I have used the sample Axes.vbp project as the basis and added the necessary code in the above events. I am including the modified events below. Am I missing something,or is this not possible? Any assistance would be very appreciated.
Code: Select all
Private Sub Form_Load()
Dim i
With TChart1
For i = 0 To 20
.Series(0).Add Rnd(30), "", clTeeColor
.Series(1).Add Rnd(30), "", clTeeColor
Next i
End With
' Add 2 cursors
TChart1.Tools.Add tcCursor
With TChart1.Tools.Items(0).asTeeCursor
.FollowMouse = True
.Style = cssVertical
.Pen.Color = vbBlue
.Pen.Style = psSolid
.Pen.Width = 3
End With
For i = 0 To 3
TChart1.Tools.Add tcCursor
With TChart1.Tools.Items(TChart1.Tools.Count - 1).asTeeCursor
.FollowMouse = False
.Style = cssVertical
.Pen.Color = vbGreen
.Pen.Style = psClear
.Pen.Width = 3
End With
Next i
ExistsCustomAxis = False
End Sub
Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
'MsgBox TChart1.Tools.Count
If Shift = ssShift Then
With TChart1.Tools.Items(0).asTeeCursor
.Series = 0
.FollowMouse = True
.Style = cssVertical
.Pen.Color = vbRed
.Pen.Style = psSolid
.Pen.Width = 2
'// .XVal = X
End With
For i = 1 To 4
With TChart1.Tools.Items(i).asTeeCursor
If .Pen.Style = psClear Then
.Series = 0
.FollowMouse = False
.Style = cssVertical
.Pen.Color = vbGreen
.Pen.Style = psDash
.Pen.Width = 5
.XVal = X
Exit For
End If
End With
Next i
'MsgBox "Setup cursor Processed"
End If
' MsgBox X & ", " & Y
End Sub
Thanks for your help
Scott