1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38:
| procedure TPrinterConfigForm.OKButtonClick(Sender: TObject); const CopyrightText: String = 'Printed with Complex Calculator - (c) by Dust Signs Andreas Unterweger 2005'; var ScalingFactor: Integer; begin Printer.PrinterIndex := PrinterComboBox.ItemIndex; if PortraitRadioButton.Checked then Printer.Orientation := poPortrait else Printer.Orientation := poLandscape; Printer.Title := 'Complex Calculator Printing Job'; Printer.BeginDoc; Hide; with MainForm do begin PaintBox1Paint(Sender); if ScaleCheckBox.Checked then begin ScalingFactor := Printer.PageWidth div PaintBox1.Width * 8 div 10; StretchBlt(Printer.Canvas.Handle, Printer.PageWidth * 1 div 10, Printer.PageHeight div 2 - ScalingFactor * PaintBox1.Height div 2, Printer.PageWidth * 8 div 10, ScalingFactor * PaintBox1.Height, PaintBox1.Canvas.Handle, 0, 0, PaintBox1.Width, PaintBox1.Height, SRCCOPY); with Printer.Canvas do begin Brush.Style := bsClear; if BoxCheckBox.Checked then Rectangle(Printer.PageWidth * 1 div 10, Printer.PageHeight div 2 - ScalingFactor * PaintBox1.Height div 2, Printer.PageWidth * 9 div 10, Printer.PageHeight div 2 + ScalingFactor * PaintBox1.Height div 2); TextOut(Printer.PageWidth * 9 div 10 - TextWidth(CopyrightText), Printer.PageHeight div 2 + ScalingFactor * PaintBox1.Height div 2 + 5, CopyrightText); end; end else begin StretchBlt(Printer.Canvas.Handle, Printer.PageWidth div 2 - PaintBox1.Width div 2, Printer.PageHeight div 2 - PaintBox1.Height div 2, PaintBox1.Width, PaintBox1.Height, PaintBox1.Canvas.Handle, 0, 0, PaintBox1.Width, PaintBox1.Height, SRCCOPY); with Printer.Canvas do begin Brush.Style := bsClear; if BoxCheckBox.Checked then Rectangle(Printer.PageWidth div 2 - PaintBox1.Width div 2, Printer.PageHeight div 2 - PaintBox1.Height div 2, Printer.PageWidth div 2 + PaintBox1.Width div 2, Printer.PageHeight div 2 + PaintBox1.Height div 2); TextOut(Printer.PageWidth div 2 - TextWidth(CopyrightText) div 2, Printer.PageHeight div 2 + PaintBox1.Height div 2 + 5, CopyrightText); end; end; end; Printer.EndDoc; Close; end; |