 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Henry Guest
|
Posted: Mon Jan 26, 2004 8:40 am Post subject: printing image of from |
|
|
I am trying to print an image of a form
here is my code:
Printer()->BeginDoc();
this->PaintTo(Printer()->Handle, 10, 10);
Printer->EndDoc();
this works, but it prints a very small image.
How can I set the size of the printed image.
Thanks
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Mon Jan 26, 2004 9:15 am Post subject: Re: printing image of from |
|
|
Henry wrote:
| Quote: | I am trying to print an image of a form
here is my code:
Printer()->BeginDoc();
this->PaintTo(Printer()->Handle, 10, 10);
Printer->EndDoc();
this works, but it prints a very small image.
How can I set the size of the printed image.
|
Yes, I have seen that before. Very small indeed.
The reason is that the resolution of your printer is much
higher than the resolution of your screen.
So in principle there are two solutions.
1. Tell your printer that it should pretend having
a much lower resolution. How to do that ? Never did that.
2. Untested:
Create an extra Graphics::TBitmap or a TCanvas and let your form
PaintTo() it. Then use CopyRect() to copy the bitmap/canvas to the
Printer()->Canvas. CopyRect() needs a source-rect and a destination-rect.
Make the dimensions of the destination-rect a multiple of the source-rect.
Copyrect will enlarge automatically.
Hans.
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Mon Jan 26, 2004 10:30 am Post subject: Re: printing image of from |
|
|
Hans Galema wrote:
| Quote: | So in principle there are two solutions.
|
3. Untested: If the complete TForm is visible on your screen you could just
use the TForm Canvas property like
Printer()->Canvas->CopyRect ( destination-rect, Canvas, source-rect );
with the destination rect a multiple of the sorce-rect.
Hans.
|
|
| Back to top |
|
 |
Dennis Jones Guest
|
Posted: Mon Jan 26, 2004 6:37 pm Post subject: Re: printing image of from |
|
|
"Hans Galema" <dontusethis (AT) dontusethis (DOT) nl> wrote
| Quote: | Henry wrote:
I am trying to print an image of a form
here is my code:
Printer()->BeginDoc();
this->PaintTo(Printer()->Handle, 10, 10);
Printer->EndDoc();
this works, but it prints a very small image.
How can I set the size of the printed image.
Yes, I have seen that before. Very small indeed.
The reason is that the resolution of your printer is much
higher than the resolution of your screen.
So in principle there are two solutions.
1. Tell your printer that it should pretend having
a much lower resolution. How to do that ? Never did that.
2. Untested:
Create an extra Graphics::TBitmap or a TCanvas and let your form
PaintTo() it. Then use CopyRect() to copy the bitmap/canvas to the
Printer()->Canvas. CopyRect() needs a source-rect and a destination-rect.
Make the dimensions of the destination-rect a multiple of the source-rect.
Copyrect will enlarge automatically.
|
Or
3. Use the Win32 API functions designed to solve this problem. Perhaps this
is what you meant in your item (1). See the "Coordinate Space and
Transformation Functions" section of the Windows API help for functions such
as:
SetWindowOrgEx
SetWindowExtEx
SetViewportOrgEx
SetViewportExtEx
OffsetViewportOrgEx
OffsetWindowOrgEx
ScaleViewportExtEx
ScaleWindowExtEx
- Dennis
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|