ImageGlass.ImageBox.GetOffsetRectangle C# (CSharp) Method

GetOffsetRectangle() public method

Returns the source T:System.Drawing.Rectangle scaled according to the current zoom level and repositioned to include the current image offset
public GetOffsetRectangle ( Rectangle source ) : Rectangle
source System.Drawing.Rectangle The source to offset.
return System.Drawing.Rectangle
        public virtual Rectangle GetOffsetRectangle(Rectangle source)
        {
            Rectangle viewport;
            Rectangle scaled;
            int offsetX;
            int offsetY;

            viewport = GetImageViewPort();
            scaled = GetScaledRectangle(source);
            offsetX = viewport.Left + Padding.Left + AutoScrollPosition.X;
            offsetY = viewport.Top + Padding.Top + AutoScrollPosition.Y;

            return new Rectangle(new Point(scaled.Left + offsetX, scaled.Top + offsetY), scaled.Size);
        }

Same methods

ImageBox::GetOffsetRectangle ( int x, int y, int width, int height ) : Rectangle
ImageBox::GetOffsetRectangle ( RectangleF source ) : RectangleF
ImageBox::GetOffsetRectangle ( float x, float y, float width, float height ) : RectangleF
ImageBox