How get position from ColorLineTool

TeeChart for ActiveX, COM and ASP
Post Reply
greenfrog
Newbie
Newbie
Posts: 2
Joined: Fri Aug 25, 2006 12:00 am
Contact:

How get position from ColorLineTool

Post by greenfrog » Mon Jan 28, 2008 1:03 am

I'm using TeeChart AX 7.x.

I want to get position of ColorLineTool by mouse dragging.

How can I do this?

Thank you.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Jan 28, 2008 8:51 am

Hi greenfrog,

You can something like following:

Code: Select all

Private Sub TChart1_OnColorLineToolDragLine()
  Label1.Caption = Str$(FormatNumber(TChart1.Tools.Items(0).asColorLine.Value, 2))
End Sub
This is shown in ColorLine Demo from v8. And if you wish to have more than one ColorLines and you want to control which is dragged you should store mouse positions with OnMouseMove and use the method clicked to verify which ColorLine is dragged:

Code: Select all

Dim MouseX, MouseY As Double

Private Sub TChart1_OnColorLineToolDragLine()
  If TChart1.Tools.Items(0).asColorLine.clicked(MouseX, MouseY) Then
    Label1.Caption = Str$(FormatNumber(TChart1.Tools.Items(0).asColorLine.Value, 2))
  End If
  
  If TChart1.Tools.Items(1).asColorLine.clicked(MouseX, MouseY) Then
    Label1.Caption = Str$(FormatNumber(TChart1.Tools.Items(1).asColorLine.Value, 2))
  End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  MouseX = X
  MouseY = Y
End Sub
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply