ZOOM-Out-Funktion in MS Diagramm c#

Habe ich Folgendes Winforms-code:

void chart1_MouseWheel(object sender, MouseEventArgs e)
        {
            double xMin = chart1.ChartAreas[0].AxisX.ScaleView.ViewMinimum;
            double xMax = chart1.ChartAreas[0].AxisX.ScaleView.ViewMaximum;
            if (e.Delta < 0)
            {   //chart1.ChartAreas[0].AxisX.ScaleView.ZoomReset();
                //chart1.ChartAreas[0].AxisY.ScaleView.ZoomReset();
            }

            if (e.Delta > 0)
            {
                double posXStart = chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X) - (xMax - xMin)/2 ;
                double posXFinish = chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X) + (xMax - xMin)/2;
                chart1.ChartAreas[0].AxisX.ScaleView.Zoom(posXStart, posXFinish);
            }
        }

Die Zoom-Funktion funktioniert, aber wenn e.Delta < 0, benötige ich die Zoom-Out-Funktion basierend auf den obigen code.

Schreibe einen Kommentar