?
Solved

Can't get PrintScale to work

Posted on 2000-05-16
2
Medium Priority
?
664 Views
Last Modified: 2011-10-03
Hi,

I've said this, I don't know how many times, but I'm sorta' a novice with Delphi.

How do I get this to work?

(From the Delphi Help Files)
type TPrintScale = (poNone, poProportional, poPrintToFit);
property PrintScale: TPrintScale;

Question is, how do I impliment it with this?

procedure TForm1.Print1Click(Sender: TObject);
begin
    with Printer do
    begin
    PrintScale := poProportional;
    BeginDoc;      { start printing }
    Canvas.Draw(0, 0, Image1.Picture.Bitmap);      { draw Image at top left corner of printed page }
    EndDoc;      { finish printing }
    end;

end;
0
Comment
Question by:fibdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 75 total points
ID: 2816291
When you're trying to output a bitmap I'd forget about using the Printscale property and stretch the image yourself using StretchDraw e.g.:

Printer.Canvas.StretchDraw(RECT(0, 0, 100, 100), Image1.Picture.Bitmap);

This of course will ruin the aspect ratio but you can work that out like so:

rX := Printer.PageWidth / Image1.Picture.Bitmap.Width;
rY := Printer.PageHeight / Image1.Picture.Bitmap.Height;

IF rY > rX
THEN
  rY := rX
ELSE
  rX := rY;

iW := ROUND(Image1.Picture.Bitmap.Width * rX);
iH := ROUND(Image1.Picture.Bitmap.Height * rY);

iCx := (Printer.PageWidth - iW) DIV 2;
iCy := (Printer.PageHeight - iH) DIV 2;

Printer.Canvas.StretchDraw(RECT(iCx, iCy, iCx + iW, iCy + iH), Image1.Picture.Bitmap);

I'm pretty sure that's right but I might have got the initial division the wrong way around

Hope that helps

The Neil =:)
0
 
LVL 3

Author Comment

by:fibdev
ID: 2823665
Didn't work, but oh well ...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question