Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. C / C++ / MFC
  3. How to print in text mode

How to print in text mode

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anojkumar
    wrote on last edited by
    #1

    Hi All , Can anyone tell me how to how to print in text mode . :eek:

    H C 2 Replies Last reply
    0
    • A anojkumar

      Hi All , Can anyone tell me how to how to print in text mode . :eek:

      H Offline
      H Offline
      Hadi Rezaee
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • A anojkumar

        Hi All , Can anyone tell me how to how to print in text mode . :eek:

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • H Hadi Rezaee

          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

          A Offline
          A Offline
          anojkumar
          wrote on last edited by
          #4

          Actually i want to dev. Activex control or one of my Visual Basic project which will allow the user to print in text mode .

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups