Move annotation

TeeChart for ActiveX, COM and ASP
Post Reply
spol
Newbie
Newbie
Posts: 27
Joined: Tue Jul 24, 2007 12:00 am

Move annotation

Post by spol » Mon Mar 02, 2009 7:43 pm

Is there a way to move annotations with the mouse? May be trapping some events ?? I read the post of
03 Mar 2004 (asAnnotation custom position) but I cannot get the attachment.

Thanks in advance,
Paolo Saudin

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

Post by Yeray » Tue Mar 03, 2009 8:29 am

Hi spol,

Here you have a fast example of how you could do this:

Code: Select all

Dim MoveAnnotation As Boolean

Private Sub Form_Load()
  TChart1.Tools.Add tcAnnotate
  TChart1.Tools.Items(0).asAnnotation.Text = "My annotation tool"
End Sub

Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If TChart1.Tools.Items(0).asAnnotation.Clicked(X, Y) Then
    MoveAnnotation = True
  End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If MoveAnnotation Then
    TChart1.Tools.Items(0).asAnnotation.Left = X
    TChart1.Tools.Items(0).asAnnotation.Top = Y
  End If
End Sub

Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  MoveAnnotation = False
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

spol
Newbie
Newbie
Posts: 27
Joined: Tue Jul 24, 2007 12:00 am

Post by spol » Tue Mar 03, 2009 12:09 pm

Thank you very much !! :D
Is what I needed

Post Reply