[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Can't get PrintScale to work

Posted on 2000-05-16
2
Medium Priority
?
675 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

Industry Leaders: 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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 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