Page 1 of 1

Cancelling Zoom in the middle of

Posted: Thu May 24, 2007 7:27 am
by 9638762
Could we cancel Zoom operation when user is in the middle of the Zoom operation..
I don't mention that AllowZoom=false

AllowZoom=true;
User started to make zoom
While user is making zoom user press "Esc" .
And i want to cancel operation .
Is it possible ?

Posted: Thu May 24, 2007 8:56 am
by 9348258
Hi Glikoz

You can try using "tChart1_KeyDown" and "tChart1_Zoomed" events. And with the Zoom.Active property, you can know if the user're doing a zoom. Your code can be something similar as below code:

Code: Select all

private bool cancelzoom = false;
        private void tChart1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape && tChart1.Zoom.Active)
                cancelzoom = true;
            else
                cancelzoom = false;
        }
        private void tChart1_Zoomed(object sender, EventArgs e)
        {
            if (cancelzoom)
                tChart1.Zoom.Undo();
            cancelzoom = false;
        }