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