private void Zoom() { if (Math.Abs(StartPoint.X - StopPoint.X) < 10 || Math.Abs(StartPoint.Y - StopPoint.Y) < 10) { return; } IsZoom = true; XMin = Option.XAxis.Min; XMax = Option.XAxis.Max; YMin = Option.YAxis.Min; YMax = Option.YAxis.Max; XMinAuto = Option.XAxis.MinAuto; XMaxAuto = Option.XAxis.MaxAuto; YMinAuto = Option.YAxis.MinAuto; YMaxAuto = Option.YAxis.MaxAuto; double xmin = XScale.CalcXPos(Math.Min(StartPoint.X, StopPoint.X), DrawOrigin.X, DrawSize.Width); double xmax = XScale.CalcXPos(Math.Max(StartPoint.X, StopPoint.X), DrawOrigin.X, DrawSize.Width); double ymax = YScale.CalcYPos(Math.Min(StartPoint.Y, StopPoint.Y), DrawOrigin.Y, DrawSize.Height); double ymin = YScale.CalcYPos(Math.Max(StartPoint.Y, StopPoint.Y), DrawOrigin.Y, DrawSize.Height); Option.XAxis.Min = xmin; Option.XAxis.Max = xmax; Option.YAxis.Min = ymin; Option.YAxis.Max = ymax; Option.XAxis.MinAuto = false; Option.XAxis.MaxAuto = false; Option.YAxis.MinAuto = false; Option.YAxis.MaxAuto = false; CalcData(); Invalidate(); }
private void Zoom() { if (Math.Abs(StartPoint.X - StopPoint.X) < 6 && Math.Abs(StartPoint.Y - StopPoint.Y) < 6) { return; } CreateBaseArea(); var zoomArea = new ZoomArea(); zoomArea.XMin = XScale.CalcXPos(Math.Min(StartPoint.X, StopPoint.X), DrawOrigin.X, DrawSize.Width); zoomArea.XMax = XScale.CalcXPos(Math.Max(StartPoint.X, StopPoint.X), DrawOrigin.X, DrawSize.Width); zoomArea.YMax = YScale.CalcYPos(Math.Min(StartPoint.Y, StopPoint.Y), DrawOrigin.Y, DrawSize.Height); zoomArea.YMin = YScale.CalcYPos(Math.Max(StartPoint.Y, StopPoint.Y), DrawOrigin.Y, DrawSize.Height); AddZoomArea(zoomArea); }