TpinterSetupDialog
, , , , TPrinterDialog . . , , :
if PrintDialog1.Execute then
begin
{ }
end;
-
Windows, . , , , , .
, , . , . FILE2POB.DPR PRNDLG.PAS. , . Dialogs PrintDialog . "", 9.8.
9.8.
_________
Procedure PrintFile;
Var
F: TextFile;
TempStr, PageNum: String;
Ctr, x, PHeight, LineSpace: Integer;
begin
Ctr:=l;
{ , }
AssignFile(F, Fname);
Reset(F);
if PrintDialogI.Execute then
Begin
{ }
Printer.BeginDoc;
{ }
PHeight:=Printer.PageHeight;
{ ,
60 }
LineSpace:= PHeight DIV 60;
{ }
PageNum:=IntToStr(Printer.PageNumber);
{ }
Labell.Caption:=' '+ Fname +
' ' + PageNum;
While Not Eof(F) Do
begin
( TempStr}
Readln(F, TempStr);
{ TempStr }
Printer.Canvas.TextOut(0, , TempStr);
{
}
:= x+LineSpace;
{ }
Ctr:= Ctr + l;
{ 60 , ,
}
If Ctr > 59 then
begin
Printer.NewPage;
x:= 0;
Ctr:= 0;
PageNum:= IntToStr(Printer.PageNumber);
Labell.Caption:= ' '+ Fname +
' ' + PageNum;
end;
end;
{
}
CloseFile(F);
Printer.EndDoc;
Labell.Caption:= ' !' +'
' = '+ PageNum;
end;
end;
_____________________________________________________________
pax:
if PrintDialogl.Execute then
begin
{ }
end;
|
|
,
(. . 9.8). , . - , (. . 9.9) .
. 9.8
. 9.9
. , , 18, Times New Roman Cyr. Font . , :
{ )
Printer.Canvas.Font.Size:= 18;
{ }
Printer.Canvas.Font.Name:= 'Times New Roman Cyr';
, . 10 , 60 . , .
, , , . , 10 LinesPerPage ( ) LineSpace ( ) , :
{ }
LinesPerPage:= PHeight Div (FontSize + 10);
{
}
LineSpace:= PHeighn Div LinesPerPage;
, , FontSise LinesPerPage. "". , 9.9.
9.9. ""
______________________________________________________________
Procedure TFormI.Button2Click(Sender: TObject);
Var
F: TextFile;
TempStr,PageNum: String;
Ctr,x,PHeight, LineSpace, LinesPerPage, FontSize: Integer;
begin
Ctr:= l;
{ , }
AssignFile(F, Fname);
Reset(F);
if PrintDialogl.Execute then
Begin
{ }
Printer.BeginDoc;
{ }
PHeight:=Printer.PageHeight;
{ 18}
Printer.Canvas.Font.Size:=18;
{ }
Printer.Canvas.Font.Name:='Times New Roman Cyr';
( ,
+ 10 }
LinesPerPage:=PHeight Div (FontSize+10);
(
}
LineSpace:= PHeight DIV LinesPerPage;
( }
PageNum:=IntToStr(Printer.PageNumber);
( }
Labell.Caption:=' '+ Fname +
' ' + PageNum;
While Not Eof F Do
begin
( TempStr}
Readln(F, TempStr);
( TempStr }
Printer.Canvas.TextOut(0, , TempStr);
(
}
:= x+LineSpace;
( }
Ctr:= Ctr+l;
( LinesPerPage ,
|
|
, }
If Ctr > LinesPerPage-1 then
begin
Printer.NewPage;
X:= 0;
Ctr:= 0;
PageNum:= IntToStr(Printer.PageNumber);
Labell.Caption:= ' '+ Fname +
' ' + PageNum;
end;
end;
( }
CloseFile(F);
Printer.EndDoc;
Labell.Caption:= ' !' + ' = '+ PageNum;
end;
end;
_________
18- Times New Roman Cyr, , , . , . , .
FontDialog, , , . . "". , , .
Font, FontDialog .
Printer.Canvas.Font.Size:= FontDialogI.Font.Sise;
, "".
Printer.Canvas.Font.Name:= / Times New Roman Cyr';
Times New Roman Cyr.
Printer.Canvas.Font.Type:= FontDialogI.Font.Type;
"".
, , . , :
NumCopies: = PrintDialogI.Copies;
NumCopies.
, "" , 9.10. Label 1. : , .
9.10. ""
_________
Procedure TFormI.Button2Click(Sender: TObject);
Var
F: TextFile;
TempStr, PageNum: String;
Ctr, x, PHeight, LineSpace, LinesPerPage,
FontSize, CopyNum, NumCopies: Integer;
begin
if PrintDialogI.Execute then
begin
Ctr:= l;
{ , }
AssignFile(F, Fname);
{ )
NumCopies:= Print Dialogi.Copies;
{ }
for CopyNum:= 1 to NumCopies do
begin
{ }
Reset(F);
{ }
:= 0;
Ctr:= 0;
{ }
Printer.BeginDoc;
{ }
Pheight:= Printer.PageHeight;
{ , }
Printer.Canvas.Font.Size:=FontDialogl.Font.Size;
{ , };
Printer.Canvas.Font.Name:= FontDialogl.Font.Name;
{ , }
Printer.Canvas.Font.Style:= FontDialogl.Font.Style;
{ ,
+ 10 }
LinesPerPage:= PHeight Div (FontSize+10);
(
}
LineSpace:= PHeight DIV LinesPerPage;
( }
PageNum:= IntToStr(Printer.PageNumber);
( }
Labell.Caption:= ' ' + Fname +
|
|
' ' + PageNum,
While Not Eof(F) do
begin
( TempStr}
Readln(F, TempStr);
( TempStr }
Printer.Canvas.TextOut(0, , TempStr);
(
}
:= x+LineSpace;
( }
Ctr:= Ctr+l;
( LinesPerPage ,
, }
If Ctr > LinesPerPage-1 then
begin
Printer.NewPage;
x:= 0;
Ctr:= 0;
PageNum:= IntToStr(Printer.PageNumber);
Labell.Caption:= ' ' + Fname +
' ' + PageNum;
end;
end;
(
}
CloseFile(F);
Printer.EndDoc;
Labell.Caption:= ' !' +
' = '+ PageNum;
Label2.Caption:= ' = ' + IntToStr(NumCopies);
end;
end;
end;
_________
, , . 9.10, . , .
, Delphi . , , , 9.11.
. 9.10
9.11.
_________
Unit Prndig;
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Printers;
type
TFormI = class(TForm)
Buttoni: TButton;
OpenDialog1: TOpenDialog;
Button2: TButton;
Label1: TLabel;
PrintDialogI: TPrintDialog;
FontDialog1: TFontDialog;
Button3: TButton;
Label2: TLabel;
Pocedure ButtonlClick(Sender: TObject);
Procedure Button2Click(Sender: TObject);
Procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Formi: TFormI;
Implementation
{$R *.DFM}
Var
Fname: String;
Procedure TFormI.ButtonlClick(Sender: TObject);
begin
if OpenDialogl.Execute then
begin
Fname:= OpenDialogl.FileName;
Labell.Caption:= ' ' + Fname;
end;
end;
Procedure TForml.Button2Click(Sender: TObject);
Var
F: TextFile;
TempStr, PageNum: String;
Ctr, x, PHeight, LineSpace, LinesPerPage,
FontSize, CopyNum, NumCopies: Integer;
begin
if PrintDialogI.Execute then
begin
Ctr:= l;
{ ,. }
AssignFile(F, Fname);
( }
NumCopies:= PrintDialogl.Copies;
{ }
for CopyNum:= 1 to NumCopies do
begin
{ }
Reset(F);
( }
:= 0;
Ctr:= 0;
{ }
Printer.BeginDoc;
{ }
Pheight:= Printer.PageHeight;
{ , }
Printer.Canvas.Font.Size:= FontDialogl.Font.Size;
{ , }
Printer.Canvas.Font.Name:= FontDialogl.Font.Name;
{ , }
Printer.Canvas.Font.Style:= FontDialogl.Font.Style;
{ ,
+ 10 }
LinesPerPage:= PHeight Div (FontSize+10);
{
}
LineSpace:= PHeight DIV LinesPerPage;
|
|
{ }
PageNum:= IntToStr(Printer.PageNumber);
( }
Label1.Caption:= ' ' + Fname +
' ' + PageNum;
While Not Eof(F) do
begin
{ TempStr}
Readln(F, TempStr);
{ TempStr }
Printer.Canvas.TextOut(0, x, TempStr);
{ x
}
x:= x+LineSpace;
{ }
Ctr:= Ctr + l;
{ LinesPerPage ,
, )
If Ctr > LinesPerPage-1 then
begin
Printer.NewPage;
X:= 0;
Ctr:= 0;
PageNum:= IntToStr(Printer.PageNumber);
Labell.Caption:= ' '+ Fname +
' ' + PageNum;
end;
end;
{ }
CloseFile(F);
Printer.EndDoc;
Labell.Caption:= ' !' + ' = '+ PageNum;
Label2.Caption:=' = ' + IntToStr(NumCopies);
end;
end;
end;
Procedure Tform1.Button3Click(Sender: TObject);
begin
FontDialogI.Execute;
end;
end.
_____________________________________________________________
"", Windows.
"" Windows "". "" Windows "". , OnClick "".
. 9.11.
10.
: .
- , . Canvas TPrinter, , . , , .
, , . Form1 .
begin
( 5 }
Form1.Canvas.Pen.Width:= 5;
{ 0,0
200,200}
Forml.Canvas.Ellipse(0, 0, 200, 200);
end;
, :
Ellipse(0, 0, 200, 200);
:
begin
{ }
Printer.BeginDoc;
{ 5 }
Printer.Canvas.Pen.Width:= 5;
{ 0,0
200,200}
Printer.Canvas.Ellipse(, , 200, 200);
{ , }
Printer.EndDoc;
end;
, , BeginDoc EndDoc Form1 Printer, . , : . , .
, , . , , , (*.bmp) Windows (*.wmf). Delphi Image, - CopyRect, . , .
.10.1
, .10.1, :
Image | |
OpenDialog | |
M | |
SpinEdit ( Samples) |
, PrintPic.dpr, - PicPrint.pas. , .10.1. " ". "" "". OpenDialog (*.bmp *.wmf) . SpinEdit MinValue 1 Value 10. Label1 " ", Label2 - " ". Image1.Stretch True, , , . , AutoSize False.
|
|
.10.2.
, , Left 0. ( 0) .
, LoadFromFile , . OpenDialog LoadFromFile. .
If OpenGialog1.Execute then
Imagel.Picture.LoadFromFile(OpenDialogI.FileName);
, , , , . 2 . CenterX CenterY.
( }
PHeight:= Printer.PageHeight;
PWidth:= Printer.PageWidth;
CenterX:= PWidth div 2;
CenterY:= PHeight div 2;
, , , Value SpinEdit. , . :
1 | |
Y1 | |
2 | |
Y2 |
, :
{ }
SDiv:= SpinEditl.Value;
XI:= CenterX - (PWidth div (SDiv*2));
Y1:= CenterY - (PHeight div (SDiv*2));
X2:= CenterX + (PWidth div (SDiv*2));
Y2:= CenterY + (PHeight div (SDiv*2));
. . CenterX CenterY. 1, . 20002000 , 1000, 1000. :
XI = 1000 - (2000 div (1*2)) = 1000 - 1000 = 0;
X2 = 1000 + (2000 div (1*2)) = 1000 + 1000 = 2000;
, X1=0, .. , 2=2000, .. . . , . div, . , .
, CopyRect, :
procedure CopyRect(Dest: TRect; Canvas: Tcanvas;
Source: TRect);
TRect. Form1.
(0,0), CopyRect , Image. (0,0) , . , , , , .
CopyRect TRect, . :
Var
PrnRect, ImgRect: TRect;
TRect Windows :
TRect = record
case Integer of
0: (Left, Top, Right, Bottom: Integer);
1: (TopLeft, BottomRight: TPoint);
end;
, . Rect . Rect X1, Y1, X2, Y2 - Left (), (), Right (). Bottom (), TRect.
:
{ Printer
PrnRect}
PrnRect:= Rect(X1, Y1, X2, Y2);
{ Image
ImgRect}
ImgRect:= Rect(0, 0, Image2.Width, Image2.Height);
, PrnRect ImgRect, CopyRect :
{ Image }
Printer.Canvas.CopyRect(PrnRect, Form1.Canvas, ImgRect);
10.1 " ". .
10.1.
_____________________________________________________________
Unit PicPrint;
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, Printers, StdCtrls, ExtCtrls, Spin;
type
Tform1 = class(TForm)
Button1: TButton;
Button2: TButton;
OpenDialog1: TOpenDialog;
Image1: Image;
SpinEdit1: TSpinEdit;
Panel1: TPanel;
Label1: Label;
Label2: TLabel;
Procedure Button1Click(Sender: TObject);
Procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TFom1;
Implementation
($R *.DFM}
Var
PHeight, PWidth: Integer;
Procedure Tform1.Button1Click(Sender: TObject);
Var
PrnRect, ImgRect: TRect;
CenterX, CenterY, X1, Y1, X2, Y2, Sdiv: Integer;
begin
Panel1.Caption:= 'ea...':
Printer.BeginDoc;
( }
PHeight:= Printer.PageHeight;
PWidth:= Printer.PageWidth;
CenterX:= PWidth div 2;
CenterY:= PHeight div 2;
( . }
Sdiv:= Spinfdit1.Value;
X1:= CenterX -(PWidth div (SDiv*2));
Y1:= CenterY -(PHeight div (Sdiv*2));
X2:= CenterX +(PWidth div (Sdiv*2));
Y2:= CenterY +(PHeight div (Sdiv*2));
{ Printer
PrnRect}
PrnRect:= Rect(X1, Y1, X2, Y2);
{ Image
ImgRect}
ImgRect:= Rect(0, 0, Image1.Width, Image1.Height);
{ Image }
Printer.Canvas.CopyRect(PrnRect, Form1.Canvas, ImgRect);
Printer.EndDoc;
Panel1.Caption:= ' !';
end;
Procedure Tform1.Button2Click(Sender: TObject);
begin
{ }
If OpenDialog1.Execute then
begin
Label2.Visible:= False;
Image1.Picture.LoadFromFile(OpenDialog1.FileName);
end;
end;
end.
_____________________________________________________________
"". Image. "". , . (*.bmp *.wmf), 1 10 . .
, .
File , .
INew | (, ) |
New Application | , , |
New Form | |
New Data Module | |
Open | , , |
Reopen | |
Save | |
Save As | |
Save Project As | |
Save All | , |
Close | |
CIose All | |
|Use Unit | (USES) |
Add to Project | |
Remove FromProject | |
Exit | Delphi |
Edit , , , .
Undo | ||||
Redo | ||||
Cut | ||||
Copy | ||||
Paste | ||||
Delete | ||||
Select All | ||||
Align to Grid | |
Bring to Front | |
Send to Back | |
Align | |
Size | |
Scale | |
Tab Order | |
Creation Order | |
Lock Controls | |
Add To Interface | , ActiveX |
Search , , .
Find | |
Find in files | , |
Replace | |
Search Again | |
Incremental Search | |
Go to Line Number | |
Show Last Compile Error | , , |
Find Error | (run-time error) |
Browse Symbol |
View , , .
Project Manager | (Project Manager) |
Project Source | |
Object Inspector | (Object Inspector) |
Alignment Palette | |
Browser | (Object Browser) |
Breakpoints | (Breakpoints List) |
Call Stack | (Call Stack) |
Watches | (Watch List) |
Threads | |
Modules | , |
Component List | |
Window List | |
Toggle Form/Unit | |
Unit | |
Forms | |
Type library | ActiveX, ActiveX - |
New Edit Window | |
SpeedBar | () |
Component Palette | () |
Project , .
Add to Project | |
Remove from Project | |
Import Type Library | ActiveX |
Add To Repository | |
Compile | , |
Build All | |
Syntax Check | |
Information | |
Web Deployment Options | ActiveX Web- |
Web Deploy | ActiveX Web- |
Options | , |
Run . .
Run | |
Parameters | |
Register ActiveX Server | ActiveX Windows |
Unregister ActiveX Server | ActiveX Windows |
Step Over | |
Trace Into | |
Trace To Next Source Line | |
Run To Cursor | , |
Show Execution Point | , |
Program Pause | |
Program Reset | |
Add Watch | |
Add breakpoint | |
Evaluate/Modify |
Component , , ActiveX, .
New Component | |
Install Component | |
Import ActiveX Control | ActiveX |
Create Component Template | |
Install Package | , |
Configure Palette |
Database .
Explore | Database Explorer SQL Database ( DELPHI) |
SQL Monitor | - SQL Monitor |
Form Wizard | , |
Tools , , Delphi, .
Environment Options | |
Repository | |
Configure Tools | Tools |
Package Collection Editor | |
Image Editor | |
Database Desktop | Database Desktop |
Workgroups .
Browse PVCS Projects | |
Mange Archive Directories | |
Add Project to Version Control | |
Set Data Directories |
Help .
Contents | |
Keyword Search | |
What's New | |
Getting Started | Getting Started |
Using Object Pascal | Using Object Pascal |
Developing Applications | Developing Applications |
Object and Component Reference | Object and Component Reference |
Borland Home Page | Web- Borland |
Delphi Home Page | Web- Borland, Delphi |
Borland Programs and Services | Web- Borland, |
About | 0 |
2