I'm writing an MFC application that produces printed reports. I do this through MFC's device context mechanism - I provide an implementation of a CScrollView's OnDraw(). All of the data that I draw comes from various STL containers that contain CStrings (a description that is mapped to an int which is a database PK, for example). I have an int offset value which increases as I draw things, so that I progressively draw down the page. The drawing logic works fine.
The problem comes when I want to split a larger report into multiple pages. I have to write code to split the containers into pages, before I do my drawing. This is typically very spaghetti-ish. This is what I've done in the past, but the particularly complex code of my most recent report makes me reconsider this approach.
Is there a better way, perhaps with dummy device contexts? Does MFC itself provide a mechanism for this?