Rapid-Q Documentation by William Yu (c)1999 Appendix A: PRINTER


PRINTER Компонент

This object is global, and need not be created. Please note that some printers do not support Draw or CopyRect. The printer component is mainly used for graphics, although it may also be suitable for text, please refer to LPRINT for text-only printing.

Printer Свойства
ПолеТипR/WПо умолчанию




AbortedINTEGERR
Aborted determintes if the user aborted the print job.
Capabilities.CopiesINTEGERR
Capabilities.Copies indicates whether the print is capable of printing multiple copies.
Capabilities.OrientationINTEGERR
Capabilities.Orientation indicates whether the print is capable of different orientations.
Capabilities.CollateINTEGERR
Capabilities.Collate indicates whether the print is capable of collating.
CopiesINTEGERRW
Number of copies to print.
CopyModeINTEGERRWcmBlackNess
FontQFONTW
FontsARRAY of STRINGR
FontsCountINTEGERR
HandleINTEGERR
OrientationINTEGERRW
Orientation determines if the print job prints vertically or horizontally on a page.
Valid orientation values are:
0 = poPortrait (Vertical print)
1 = poLandscape (Horizontal print)
PageHeightINTEGERR
PageNumberINTEGERR
PageWidthINTEGERR
PrinterIndexINTEGERRW
PrintersARRAY of STRINGR
PrintersCountINTEGERR
PrintingINTEGERR
TitleSTRINGRW
Title is the text that appears in the Print Manager and on network header pages.


Printer Методы
МетодТипОписаниеПараметры




AbortSUBAbort printing the document0
BeginDocSUBStarts new document to print0
BeginDoc sends a print job to the printer.
EndDocSUBNothing is printed until this is called0
EndDoc will start the print job.
NewPageSUBStart printing on a new page0
CircleSUB (x1%, y1%, x2%, y2%, c%, fill%)Рисует и заливает окружность6
CopyRectSUB (D, Image, S)D и S это QRECTs, Image может быть QImage, QCanvas, или QBitmap3
DrawSUB (x%, y%, BMP)Выводит рисунок на "холст" (Рисовать BitMap on Canvas)3
FillRectSUB (x1%, y1%, x2%, y2%, c%)Рисует и заливает цветом прямоугольник5
LineSUB (x1%, y1%, x2%, y2%, c%)Рисует линию5
PaintSUB (x%, y%, c%, borderc%)Заполняет область4
PsetSUB (x%, y%, c%)Рисует точку3
RectangleSUB (x1%, y1%, x2%, y2%, c%)Рисует прямоугольник5
RoundRectSUB (x1%, y1%, x2%, y2%, x3%, y3%, c%)Рисует & Заполняет цветом прямоугольник со скругленными углами7
StretchDrawSUB (Rect AS QRECT, BMP)Рисует BMP и растягивает его до заполнения заданного прямоугольника2
TextHeightFUNCTION (Text$) AS WORDВозвращает высоту, в пикселях, строки Text$1
TextWidthFUNCTION (Text$) AS WORDВозвращает ширину, в пикселях, строки Text$1
TextRectSUB (Rect AS QRECT, x%, y%, S$, fc%, bc%)Выводит текст, обрезая по границам региона Rect6
TextOutSUB (x%, y%, S$, fc%, bc%)Writes text to printer5


Printer Примеры
DECLARE SUB ButtonClick

SUB ComboBoxChange(Sender AS QComboBox)
  Printer.PrinterIndex = Sender.ItemIndex   '-- Change default printer
END SUB

DIM Font AS QFont
    Font.Color = &HFF0000
    Font.Name = "Arial"
    Font.Size = 20
DIM Bitmap AS QBitmap
Bitmap.BMP = "rapidq.bmp"


CREATE Form AS QForm
  CREATE ComboBox AS QComboBox
    Left = 5
    Top = 5
    Width = 150
    OnChange = ComboBoxChange
  END CREATE
  CREATE Button AS QButton
    Caption = "&Print"
    Top = 3
    Left = 180
    OnClick = ButtonClick
  END CREATE
  CREATE GroupBox AS QGroupBox
    Caption = "Print Preview..."
    Top = 35
    Width = Form.ClientWidth
  END CREATE
  Center
END CREATE

FOR I = 0 TO Printer.PrintersCount-1
  ComboBox.AddItems(Printer.Printers(I))    '-- Add printer list to combobox
NEXT
ComboBox.ItemIndex = Printer.PrinterIndex

Form.ShowModal

SUB ButtonClick
  Printer.Orientation = 1   ' Landscape
  Printer.BeginDoc
  Printer.TextOut(1000,1000,"Hi World!",0,-1)
  Printer.Font = Font
  Printer.TextOut(10,10,"Does this print?",0,-1)
  Printer.Line(10,10,500,500,0)
  Printer.EndDoc
END SUB

Предыдущий Компонент Содержание Следующий Компонент