Drawing on Canvas

TeeChart for ActiveX, COM and ASP
Post Reply
Rossmc
Newbie
Newbie
Posts: 27
Joined: Wed Jul 28, 2004 4:00 am
Location: South Africa

Drawing on Canvas

Post by Rossmc » Tue May 03, 2005 4:28 pm

Sorry to be a nuisance but none of my help files are helpful.

On my chart I have a vertical teecursor following mouse no problem.
If cursor is on and user left-clicks, I want to drop a stationary line at the current xval of the cursor. Is this easy to do?
I see I may be able to simply add yet another vertical cursor that doesn't follow mouse, but how do I determine tool(0) xval on a click event?

Thanks again...
Ross

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 04, 2005 9:15 am

Hi Ross,

You can draw directly to the chart canvas. The OnMouseDown event already gives you X and Y values:

Code: Select all

Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    With TChart1
      .Canvas.MoveTo X, .Axis.Top.Position
      .Canvas.LineTo X, .Axis.Bottom.Position
    End With
End Sub
You can also determine tool's X and Y values using the OnCursorToolChange event.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply