Kyoung-hoon Kim Member
Joined: 25 May 2004 Posts: 1 Location: ? Started With Delphi 6.0 a Few Months ago.
|
Posted: 25/05/04 08:31 Post subject: TPrinter-How can make same. |
|
|
Hi. This is my First Question on DELPHIAREA.
I'm programming the printing app which have preview function.
But, don't use TPrintPreview from DELPHIAREA. It just for my study.
First, here's my code.
| Code: |
///////////////////////////////////////////////////////////////
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls, printers, Winspool;
type
TForm1 = class(TForm)
Image1: TImage;
btnPreview: TButton;
btnPrint: TButton;
procedure btnPreviewClick(Sender: TObject);
procedure btnPrintClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Types;
{$R *.dfm}
procedure DrawLine(Canvas: TCanvas);
begin
with Canvas do
begin
Brush.Color := clNavy;
Brush.Style := bsDiagCross;
Rectangle(100, -2200, 2000, -2500);
Pen.Color := clRed;
Brush.Color := clYellow;
Ellipse(100, -1000, 8000, -1200);
end;
end;
//--- TO Preview ---
procedure TForm1.btnPreviewClick(Sender: TObject);
begin
SetMapMode(Image1.Canvas.Handle, MM_LOMETRIC);
DrawLine(Image1.Canvas);
end;
//--- TO Print ---
procedure TForm1.btnPrintClick(Sender: TObject);
begin
Printer.BeginDoc;
SetMapMode(Printer.Handle, MM_LOMETRIC);
DrawLine(Printer.Canvas);
Printer.EndDoc;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
btnPreviewClick(self);
end;
end.
//////////////////////////////////
|
But, I can't make them look same, the look from Monitor and the look from printed paper. Or, How can I get the size of the 'Image1' to make them look same? _________________ ? Started With Delphi 6.0 a Few Months ago. |
|