A: Here is the unit from one that I did:
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, printers, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
bmp: TBitmap;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var r: TRect;
begin
with r do
begin
left := 0;
top := 0;
right := 2000;
bottom := 2000;
end;
printer.begindoc;
printer.canvas.stretchDraw(r, image1.picture.graphic);
printer.EndDoc;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bmp := TBitmap.create;
bmp.width := image1.width;
bmp.height := image1.height;
image1.picture.graphic := bmp;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
with image1.canvas do
begin
brush.color := clMaroon;
pen.width := 5;
pen.color := clNavy;
rectangle(10, 10, 150, 150);
end;
end;
end.