Page 1 of 1

Mouse wheel event

Posted: Wed Apr 21, 2010 6:49 pm
by 9085137
Hi,

Is it possible to catch mouse wheel event? If I can, I would like to use this event for zooming in and out rather than scrolling up and down.

dalshin

Re: Mouse wheel event

Posted: Thu Apr 22, 2010 10:59 am
by yeray
Hi dalshin,

If you can catch the MouseWheel event in your IDE, you can catch it for the TeeChart control. For example, in VS2008:

Code: Select all

        private void InitializeChart()
        {            
            axTChart1.Aspect.View3D = false;

            axTChart1.AddSeries(TeeChart.ESeriesClass.scFastLine);
            axTChart1.Series(0).FillSampleValues(25);

            this.MouseWheel += new MouseEventHandler(Form1_MouseWheel);            
        }

        void Form1_MouseWheel(object sender, MouseEventArgs e)
        {
            axTChart1.Header.Caption = "mousewheel event";
            Rectangle rect = new Rectangle(axTChart1.Location.X, axTChart1.Location.Y, axTChart1.ChartBounds.Right-axTChart1.ChartBounds.Left,axTChart1.ChartBounds.Bottom-axTChart1.ChartBounds.Top);
            if (rect.Contains(e.X, e.Y))
            {
                axTChart1.Header.Caption = axTChart1.Header.Caption + " in chart";
            }
        }