protected override void OnMouseUp(MouseEventArgs args) { base.OnMouseUp(args); MsaglMouseEventArgs iArgs = CreateMouseEventArgs(args); gViewer.RaiseMouseUpEvent(iArgs); if (NeedToEraseRubber) { DrawXORFrame(); } if (!iArgs.Handled) { if (gViewer.OriginalGraph != null && MouseDraggingMode == DraggingMode.WindowZoom) { System.Drawing.Point p = mouseDownPoint; double f = Math.Max(Math.Abs(p.X - args.X), Math.Abs(p.Y - args.Y)) / GViewer.dpi; if (f > gViewer.ZoomWindowThreshold && zoomWindow) { mouseUpPoint = new System.Drawing.Point(args.X, args.Y); if (ClientRectangle.Contains(mouseUpPoint)) { System.Drawing.Rectangle r = GViewer.RectFromPoints(mouseDownPoint, mouseUpPoint); r.Intersect(gViewer.DestRect); if (GViewer.ModifierKeyWasPressed() == false) { mouseDownPoint.X = r.Left; mouseDownPoint.Y = r.Top; mouseUpPoint.X = r.Right; mouseUpPoint.Y = r.Bottom; P2 p1 = gViewer.ScreenToSource(mouseDownPoint); P2 p2 = gViewer.ScreenToSource(mouseUpPoint); double sc = Math.Min((double)ClientRectangle.Width / r.Width, (double)ClientRectangle.Height / (double)r.Height); P2 center = 0.5f * (p1 + p2); gViewer.Zoom(center.X, center.Y, sc * gViewer.ZoomF); } } } } } zoomWindow = false; }