There's some duplication here with `WM_PAINT`. Could you perhaps refactor it into a "DrawImageIntoDC" function, or something like that?