PrinterOrientation (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses two radio buttons on a form named Landscape and Portrait. The form also includes a button. When you select an orientation by clicking one of the radio buttons and then you the button to print one line of text, the print job prints using the selected orientation.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Printer()->BeginDoc();
  Printer()->Canvas->TextOut(100,100,"Hi there!");
  Printer()->EndDoc();
}

void __fastcall TForm1::PortraitClick(TObject *Sender)
{
  Printer()->Orientation = poPortrait;
}

void __fastcall TForm1::LandscapeClick(TObject *Sender)
{
  Printer()->Orientation = poLandscape;
}

Uses