Search code examples
activexteechart

Teechart ZoomIn and ZoomOut Button


I am using the zooming of TCHART. In our application we have a Next and Prev Button using which user can do Zoom and UndoZoom. Can you let me know how I can fire zoom and undozoom event on click on this two Buttons


Solution

  • You can either call the even methods directly (see code below) or use the calls that will fire the events (see commented code below).

    Private Sub Command1_Click()
        TChart1_OnZoom
        'TChart1.Zoom.ZoomRect 0, 0, 100, 100
    End Sub
    
    Private Sub Command2_Click()
        TChart1_OnUndoZoom
        'TChart1.Zoom.Undo
    End Sub
    
    Private Sub TChart1_OnUndoZoom()
        TChart1.Header.Text.Clear
        TChart1.Header.Text.Add "Unzoom!"
    End Sub
    
    Private Sub TChart1_OnZoom()
        TChart1.Header.Text.Clear
        TChart1.Header.Text.Add "Zoom!"
    End Sub