public ZoomToRegion ( |
||
rectangle | The rectangle to fit the view port to. | |
return | void |
public virtual void ZoomToRegion(RectangleF rectangle)
{
double ratioX;
double ratioY;
double zoomFactor;
int cx;
int cy;
ratioX = ClientSize.Width / rectangle.Width;
ratioY = ClientSize.Height / rectangle.Height;
zoomFactor = Math.Min(ratioX, ratioY);
cx = (int)(rectangle.X + (rectangle.Width / 2));
cy = (int)(rectangle.Y + (rectangle.Height / 2));
Zoom = (int)(zoomFactor * 100);
CenterAt(new Point(cx, cy));
}
ImageBox::ZoomToRegion ( float x, float y, float width, float height ) : void | |
ImageBox::ZoomToRegion ( int x, int y, int width, int height ) : void |