public void ZoomOut() { PrjRectangleF _viewport = _mapcontrol.Viewport; double zoomWidthAmount = _viewport.Width * panzoomFactor; double zoomHeightAmount = _viewport.Height * panzoomFactor; PrjRectangleF newViewport = _viewport; newViewport.Inflate(zoomWidthAmount, zoomHeightAmount); // _mapcontrol.SetViewportByPrj(newViewport); }
protected override void HandleRectBox(Point prjLeftUp, Point prjRightBottom) { PrjRectangleF rect = new PrjRectangleF(); rect.MinX = prjLeftUp.X; rect.MaxX = prjRightBottom.X; rect.MinY = prjRightBottom.Y; rect.MaxY = prjLeftUp.Y; // PrjRectangleF oldrect = _mapcontrol.Viewport; double panzoomFactor = Math.Min(oldrect.Width / rect.Width, oldrect.Height / rect.Height); double zoomWidthAmount = oldrect.Width * panzoomFactor; double zoomHeightAmount = oldrect.Height * panzoomFactor; // rect.Inflate(zoomWidthAmount, zoomHeightAmount); // _mapcontrol.SetViewportByPrj(rect); }