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

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "Drukowanie.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
	ComboBox1->Items=Printer()->Printers;
	ComboBox1->ItemIndex=Printer()->PrinterIndex;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	if (PrintDialog1->Execute())
		RichEdit1->Print("Drukowanie dokumentu z aplikacji "+Application->Title);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
	Printer()->PrinterIndex=ComboBox1->ItemIndex;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
   TStringList* tekst=new TStringList();
   tekst->Add("Czcionki ekranowe:");
   tekst->AddStrings(Screen->Fonts);
   tekst->Add("");
   tekst->Add("Czcionki drukarki:");
   tekst->AddStrings(Printer()->Fonts);
   ShowMessage("Ilość linii: "+IntToStr(tekst->Count));

   TFont* czcionka=new TFont();
   czcionka->Assign(Printer()->Canvas->Font);
   czcionka->Size=12;
   czcionka->Name="Times New Roman";
   czcionka->Color=clNavy;
   int strony=Drukuj(tekst,czcionka,false,"Drukowanie listy czcionek");
   ShowMessage("Wydrukowano "+IntToStr(strony)+" stron");

   delete tekst;
   delete czcionka;
}
//---------------------------------------------------------------------------
