How to print in text mode
-
You mean in MS-DOS mode and by C++ ? My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
-
You mean print to the printer ? If your mapping mode is MM_TEXT, you'll find everything is stupidly small, because an A4 page can have 4000x6000 'pixels' and so you get a postage stamp in the corner from your code created for 800 x 600. I set up a flag to make the code in OnPrepareDC/OnDraw/OnPaint not execute at all, because what I'm working on, I want a different result when I print ( a report ) anyhow. I do all my printing in OnPrint. If you *do* want the printing to be the same, the trick is to draw things relative to the DC size, which you get from GetDeviceCaps(dc, HORZRES) and VERTRES. Either way this is how I do my OnPRint, because I don't know ahead of time the DPI of the printer my users will be using. If you do this and draw with stretch blt, you'll be able to get your bitmaps to print OK. For text, you need to use a function that takes a DC and allows you to specify a font size in points. I think CFont has CreatePtFont, but I'm not sure ( it's something like that, but I learned about it here about a week ago ). In GDI+ you specify fonts in points automatically. When I moved to GDI+ I finally got all my fonts perfectly as I requested them, the same in my preview ( which I draw myself in a seperate function ) and my page. This is essentially because GDI+ IMHO behaves more as I expected it to in terms of the size of the font returned ( although it just may have been because I'd never discovered CreatePtFont ). Sorry if this rambled a little - if you need more info, just ask. I can post some code to do it tomorrow at work if you're still stuck. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
-
You mean in MS-DOS mode and by C++ ? My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie