Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Printing FMX TForm



Permlink Replies: 0
midou sidou

Posts: 11
Registered: 6/15/06
Printing FMX TForm
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 10, 2016 10:54 AM
Hello

I would like to know how to print the contents of a TForm (TLabel, TEdit, TStringGrid, etc.).

I found this code to print an image:
void __fastcall TMyForm::PrintButtonClick(TObject *Sender)
{
TRectF SrcRect, DestRect;
TPrinter *Printer = Printer;

Printer->ActivePrinter->SelectDPI(1200, 1200);

Printer->Canvas->Fill->Color = claBlack;
Printer->Canvas->Fill->Kind = TBrushKind(1);

Printer->BeginDoc();

SrcRect = Image1->LocalRect;
DestRect = TRectF(0, 0, Printer->PageWidth, Printer->PageHeight);

Printer->Canvas->DrawBitmap(Image1->Bitmap, SrcRect, DestRect, 1);

Printer->EndDoc();
}

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02