- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
fortran_winprint.f90 is used to print a text file.
How can you print screen graphics?
Thanks, David
How can you print screen graphics?
Thanks, David
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A quickWin program has menus File and Edit. Under the File menu is a 'Print..' command which will print the current graphics window.
you can also use the 'select graphics' item in the 'Edit menu' and the 'Copy' item to
copy selected graphics to the clipboard. This can then be pasted into Word and printed off.
you can also use the 'select graphics' item in the 'Edit menu' and the 'Copy' item to
copy selected graphics to the clipboard. This can then be pasted into Word and printed off.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is Windows API project not QuickWin.
As you say, I could just copy the screen to the clip board and print using Paint, but I would like to get a better resolution.
Thanks, David
As you say, I could just copy the screen to the clip board and print using Paint, but I would like to get a better resolution.
Thanks, David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since you are using Win32 API already, your subroutine that handles WM_PAINT messages already does most of the work that you need to do. Look at the documentation for the PrintDlg function -- there actually isn't much to it if you don't have to print to network printers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...to extend James' idea, most of the time you should be able to reuse the code
from WM_PAINT handler; the following steps, however, should be necessary:
1) Call PrintDlg (simplest) to obtain printer hDC;
2) Before drawing you should call:
GetDeviceCaps(LOGPIXELS* to obtain horz & vert. resolution
GetDeviceCaps(PHYSICALWIDTH/HEIGHT to obtain paper dimensions in pixels
SetMapMode() to specify scaling; the default is MM_TEXT, meaning that your
drawing will be a tiny spot in upper left corner. MM_ISOTROPIC arbitrarily scales
the coordinate system, preserving aspect ratio; MM_ANISOTROPIC also arbitrarily
scales but not preserving aspect ratio;
SetViewportOrgEx & SetViewportExtEx to (0,0, PaperWidth, PaperHeight)
SetWindowOrgEx & SetWindowExtEx to (0,0, YourWindowWidth, YourWindowHeight)
StartDoc()
StartPage()
--- WM_PAINT code here --------
EndPage()
EndDoc()
The only thing you should take care of is CreateFont (whose input is in pixels, not in logical units). You should use FontSizePt*GetDeviceCaps(hDC,LOGPIXELSY)/72 as font size argument (note that for screen, the latter value is 72 so you get what you had before; for printer, you get the font of correct value).
See "2-D graphics/Coordinate spaces and transformations" chapter in SDK -- these should give you a good understanding. If you're familiar with QuickWin, Win32 "device units" correspond to QW "Viewport coordinates" while "logical units" correspond to QW "Window coordinates".
HTH
Jugoslav
from WM_PAINT handler; the following steps, however, should be necessary:
1) Call PrintDlg (simplest) to obtain printer hDC;
2) Before drawing you should call:
GetDeviceCaps(LOGPIXELS* to obtain horz & vert. resolution
GetDeviceCaps(PHYSICALWIDTH/HEIGHT to obtain paper dimensions in pixels
SetMapMode() to specify scaling; the default is MM_TEXT, meaning that your
drawing will be a tiny spot in upper left corner. MM_ISOTROPIC arbitrarily scales
the coordinate system, preserving aspect ratio; MM_ANISOTROPIC also arbitrarily
scales but not preserving aspect ratio;
SetViewportOrgEx & SetViewportExtEx to (0,0, PaperWidth, PaperHeight)
SetWindowOrgEx & SetWindowExtEx to (0,0, YourWindowWidth, YourWindowHeight)
StartDoc()
StartPage()
--- WM_PAINT code here --------
EndPage()
EndDoc()
The only thing you should take care of is CreateFont (whose input is in pixels, not in logical units). You should use FontSizePt*GetDeviceCaps(hDC,LOGPIXELSY)/72 as font size argument (note that for screen, the latter value is 72 so you get what you had before; for printer, you get the font of correct value).
See "2-D graphics/Coordinate spaces and transformations" chapter in SDK -- these should give you a good understanding. If you're familiar with QuickWin, Win32 "device units" correspond to QW "Viewport coordinates" while "logical units" correspond to QW "Window coordinates".
HTH
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page