RAD Studio VCL Reference
|
Indicates the value of width (in pixels) of the currently printing page.
property PageWidth: Integer;
__property int PageWidth;
Use PageWidth to find the width in pixels of the currently printing page.
C++ Examples:
/* This example uses a button and a memo on a form. When the user clicks the button, the content of the memo is printed, with a 200-pixel border around the page. Note: The TMemo will wrap the lines of the text files, so to see the TextRect clip, the memo width must be large and the lines in the text file must be long. */ void __fastcall TForm1::FormCreate(TObject *Sender) { Memo1->Width = 1000; Memo1->Lines->LoadFromFile("..\\readme.txt"); } void __fastcall TForm1::Button1Click(TObject *Sender) { Printer()->BeginDoc(); int margin = 1000; int X = margin; int Y = margin; int I = 0; while(Y < Printer()->PageHeight) { Canvas->TextRect(Rect(X, Y, Printer()->PageWidth-margin, Printer()->PageHeight-margin), X, Y, Memo1->Lines->Strings[I]); Y = Y + 100; I = I + 1; } Printer()->EndDoc(); }
Delphi Examples:
{ This example uses a button and a memo on a form. When the user clicks the button, the content of the memo is printed, with a 200-pixel border around the page. To run this example successfully, include <Printers.hpp> in your unit file. Note: The TMemo will wrap the lines of the text files, so to see the TextRect clip, the memo width must be large and the lines in the text file must be long. } uses Printers; procedure TForm1.Button1Click(Sender: TObject); var X, Y, I, margin: Integer; begin with Printer do begin BeginDoc; margin := 1000; X := margin; Y := margin; I := 0; while(Y < PageHeight) do begin Canvas.TextRect(Rect(X, Y, PageWidth-margin, PageHeight-margin), X, Y, Memo1.Lines[I]); Y := Y + 100; I := I + 1; end; EndDoc; end; end; procedure TForm1.FormCreate(Sender: TObject); begin Memo1.Width := 1000; Memo1.Lines.LoadFromFile('readme.txt'); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|