' Rapid-Q by William Yu (c)1999-2000 . ' ================================================================================ ' Upload_il_tuo_script_su_Rapidq.it ' Printer ****** PRINTER Component ****** 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 Properties Field Type R/W Default ======================== ================= ================= ================== Aborted INTEGER R Aborted determintes if the user aborted the print job. Capabilities.Copies INTEGER R Capabilities.Copies indicates whether the print is capable of printing multiple copies. Capabilities.Orientation INTEGER R Capabilities.Orientation indicates whether the print is capable of different orientations. Capabilities.Collate INTEGER R Capabilities.Collate indicates whether the print is capable of collating. Copies INTEGER RW Number of copies to print. CopyMode INTEGER RW cmBlackNess Font QFONT W Fonts ARRAY of STRING R FontsCount INTEGER R Handle INTEGER R Orientation INTEGER RW 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) PageHeight INTEGER R PageNumber INTEGER R PageWidth INTEGER R PrinterIndex INTEGER RW Printers ARRAY of STRING R PrintersCount INTEGER R Printing INTEGER R Title STRING RW Title is the text that appears in the Print Manager and on network header pages. Printer Methods Method Type Description Params =================== =================== =================== =================== Abort SUB Abort printing the 0 document BeginDoc SUB Starts new document 0 to print BeginDoc sends a print job to the printer. EndDoc SUB Nothing is printed 0 until this is called EndDoc will start the print job. NewPage SUB Start printing on a 0 new page Circle SUB (x1%, y1%, x2%, Draw & Fill 6 y2%, c%, fill%) Circle CopyRect SUB (D, Image, S) D and S are QRECTs, 3 Image can be a QImage, QCanvas, or QBitmap Draw SUB (x%, y%, BMP) Draw Bitmap on 3 Canvas FillRect SUB (x1%, y1%, x2%, Draws & Fills a 5 y2%, c%) rectangle Line SUB (x1%, y1%, x2%, Draws a line 5 y2%, c%) Paint SUB (x%, y%, c%, Fill Region 4 borderc%) Pset SUB (x%, y%, c%) Pixel plot 3 Rectangle SUB (x1%, y1%, x2%, Draws a rectangle 5 y2%, c%) RoundRect SUB (x1%, y1%, x2%, Draws & Fills a 7 y2%, x3%, y3%, c%) rounded rectangle StretchDraw SUB (Rect AS QRECT, Draw BMP and 2 BMP) stretch to fit inside Rect TextHeight FUNCTION (Text$) AS Returns the height, 1 WORD in pixels, of Text$ string TextWidth FUNCTION (Text$) AS Returns the width, 1 WORD in pixels, of Text$ string TextRect SUB (Rect AS QRECT, Write text, and 6 x%, y%, S$, fc%, clip within region bc%) Rect TextOut SUB (x%, y%, S$, Writes text to 5 fc%, bc%) printer Printer Examples 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 ' =============================================================================== ' 2003 Holyguard.net - 2007_Abruzzoweb