Learn Create Your Own Split Screen

Next Page

To make the image flip, we use the scale method of the device context.

Scale has the effect of multiplying every x and y co-ordinate by a certain number.

Once you set a scale, it stays in effect. So it's good we're using save/restore so we can make these gyrations, draw our image, then put the device context back the way we found it.

If you scaled the x-coordinates by -1, whenever you try to draw something as position 100, it will instead get drawn at -100.

Normally that would be off-screen, but because we've used translate to move the zero-point to the centre of the image, everything works nicely.