MegaMan.LevelEditor.JoinOverlay.JoinOverlay_Paint C# (CSharp) Method

JoinOverlay_Paint() private method

private JoinOverlay_Paint ( object sender, PaintEventArgs e ) : void
sender object
e PaintEventArgs
return void
        void JoinOverlay_Paint(object sender, PaintEventArgs e)
        {
            Control c = sender as Control;
            Point loc;
            if (c is ScreenDrawingSurface) loc = c.Location;
            else loc = new Point(0, 0);
            // when scrolling, the actual Location property of the control changes. So to compensate,
            // we have to also subtract the scroll amount so that the image is always drawn on right area of the control.
            e.Graphics.DrawImageUnscaled(image, -loc.X - Owner.HorizontalScroll.Value, -loc.Y - Owner.VerticalScroll.Value, c.Width, c.Height);
        }