I’m drawing some graphics and text with GDI in my CScrollView. I need to implement the zooming functionality. I only need the zoom out functionality, no need to zoom in more than what is normally rendered.
Here are my best ideas:
-
Use MM_ANISOTROPIC mapping mode with SetWindowExt/SetViewportExt… The problem with this approach is that it does not scale text. Is there any way to force MFC to scale the text as well? Only thing I can think of is to set text font size according to the selected zoom value, but I’m not sure whether this will look well after all…
-
Draw to memory DC, and use StretchBlt to blit to the client area of appropriate size (set with SetScrollSizes…). This will solve the text scaling issue.
Also it is desirable to have antialiasing effect in the process. I think both methods above should accomplish this per se, but I don’t know which will look better. Also I will have to implement printing/print-preview functionality later (using MFC’s standard implementation from doc/view architecture), so I need the method to be compatible with that.
Need your advice please. Which way to go and why. Maybe other options exist too?..
I ended up using the second method I proposed in the question, but used DIBs instead of DDBs (and
StretchDIBits()instead ofStretchBlt()) because it proved to cause less problems, especially when using big bitmaps, and when printing.