//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "PrinterPageNumber.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: PrinterPageNumber
// Property: Printers.TPrinter.PageNumber

// BeginCode
/*
This example uses a button and a status bar on a form. When
the user clicks the button, one line of text is printed on
six separate pages. As each page is printed, a message
indicating the number of the page being printed appears on
the status bar.  Notice that the SimplePanel property of the
status bar to must be set to true.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  StatusBar1->SimplePanel = True; // so that SimpleText will work
  Printer()->BeginDoc();
  for (int i = 1;i < 7;i++)
  {
	Printer()->Canvas->TextOut(100, 100, "C++Builder rules!");
	StatusBar1->SimpleText = AnsiString("Printing page ") + Printer()->PageNumber;
    Printer()->NewPage();
  }
  Printer()->EndDoc();
}
// EndCode
// EndExample: PrinterPageNumber
//---------------------------------------------------------------------------
