home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5368 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  2.5 KB

  1. Path: sparky!uunet!lax.pe-nelson.com!lax!twbrown
  2. From: twbrown@PE-Nelson.COM (Tom W. Brown)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Changing horses in midstream.
  5. Message-ID: <753@lax.lax.pe-nelson.com>
  6. Date: 26 Jan 93 02:25:17 GMT
  7. References: <1k1886INNbek@iguana.cis.ohio-state.edu>
  8. Sender: news@lax.pe-nelson.com
  9. Organization: PE-Nelson
  10. Lines: 46
  11.  
  12. In article <1k1886INNbek@iguana.cis.ohio-state.edu>, guzman@cis.ohio-state.edu (jonatan guzman) writes:
  13. |> ...well, just about!
  14. |> 
  15. |> I have a program that needs to print a number of documents, and needs to change
  16. |> the mode (landscape/portrait) depending on the document. Anybody out there 
  17. |> know how to do this?
  18.  
  19. There are two basic approaches:
  20.  
  21.    1) Always plot in what is essentially portrait mode and tell the printer
  22.       driver to flip into Portrait or Landscape mode via a call to
  23.       ExtDeviceMode().  See documentation for that call for more info.
  24.  
  25.    2) Always assume that the printer is in Portrait mode and setup your
  26.       mapping mode to give the effect of portrait or landscape.
  27.  
  28. I've done it both ways.  (1) may be easier if you've already got the graphics
  29. code written and it makes hard to change assumptions about the mapping mode.
  30. (2) can be pretty powerful since you can do fancy (albeit mostly useless :-)
  31. things like printing upside-down and backwards by altering your window and
  32. viewport mapping.
  33.  
  34. I'm pretty sure that a printer driver can only be flipped between Portrait
  35. and Landscape mode between printer jobs.  So if you have a single print
  36. job where different pages need different orientations then you have to use
  37. the second approach.
  38.  
  39.  
  40. |> 
  41. |> As long as we're on the printing subject, who knows how to determine how many
  42. |> lines of x point size, z facename print will fit on a given page size? the
  43. |> page size is determined via the GetDeviceCaps(hDC, HORZRES/VERTRES) function.
  44.  
  45. Select the desired font in the DC and use GetTextMetrics() to get the
  46. LOGFONT data for the text.  The combination of lfHeight + lfExternalLeading
  47. is commonly used for the line height.  Note that this value will be in
  48. logical units (the same as device units if you've left the DC in MM_TEXT
  49. mapping mode).
  50.  
  51.  
  52.  
  53. ----------------------------------------------------------------------------
  54. Tom Brown               |  "She turned me into a newt...
  55. PE Nelson Systems       |                                  ... I got better"
  56. twbrown@pe-nelson.com   |                    Monty Python and the Holy Grail
  57. ----------------------------------------------------------------------------
  58.