⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 print.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 4 页
字号:
\membersection{wxPrinter::GetAbort}\label{wxprintergetabort}\func{bool}{GetAbort}{\void}Returns true if the user has aborted the print job.\membersection{wxPrinter::GetLastError}\label{wxprintergetlasterror}\func{static wxPrinterError}{GetLastError}{\void}Return last error. Valid after calling \helpref{Print}{wxprinterprint},\helpref{PrintDialog}{wxprinterprintdialog} or \helpref{wxPrintPreview::Print}{wxprintpreviewprint}. These functions set last error to {\bf wxPRINTER\_NO\_ERROR} if no error happened.Returned value is one of the following:\twocolwidtha{7cm}\begin{twocollist}\itemsep=0pt\twocolitem{{\bf wxPRINTER\_NO\_ERROR}}{No error happened.}\twocolitem{{\bf wxPRINTER\_CANCELLED}}{The user cancelled printing.}\twocolitem{{\bf wxPRINTER\_ERROR}}{There was an error during printing.}\end{twocollist}\membersection{wxPrinter::GetPrintDialogData}\label{wxprintergetprintdialogdata}\func{wxPrintDialogData\&}{GetPrintDialogData}{\void}Returns the \helpref{print data}{wxprintdata} associated with the printer object.\membersection{wxPrinter::Print}\label{wxprinterprint}\func{bool}{Print}{\param{wxWindow *}{parent}, \param{wxPrintout *}{printout}, \param{bool }{prompt=true}}Starts the printing process. Provide a parent window, a user-defined wxPrintout object which controlsthe printing of a document, and whether the print dialog should be invoked first.Print could return false if there was a problem initializing the printer device context(current printer not set, for example) or the user cancelled printing. Call\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailedinformation about the kind of the error.\membersection{wxPrinter::PrintDialog}\label{wxprinterprintdialog}\func{wxDC*}{PrintDialog}{\param{wxWindow *}{parent}}Invokes the print dialog. If successful (the user did not press Canceland no error occurred), a suitable device context will be returned(otherwise NULL is returned -- call\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailedinformation about the kind of the error).The application must delete this device context to avoid a memory leak.\membersection{wxPrinter::ReportError}\label{wxprinterreporterror}\func{void}{ReportError}{\param{wxWindow *}{parent}, \param{wxPrintout *}{printout}, \param{const wxString\& }{message}}Default error-reporting function.\membersection{wxPrinter::Setup}\label{wxprintersetup}\func{bool}{Setup}{\param{wxWindow *}{parent}}Invokes the print setup dialog. Note that the setup dialog is obsolete fromWindows 95, though retained for backward compatibility.\section{\class{wxPrinterDC}}\label{wxprinterdc}A printer device context is specific to MSW and Mac, and allows access to anyprinter with a Windows or Macintosh driver. See \helpref{wxDC}{wxdc} for furtherinformation on device contexts, and \helpref{wxDC::GetSize}{wxdcgetsize} foradvice on achieving the correct scaling for the page.\wxheading{Derived from}\helpref{wxDC}{wxdc}\\\helpref{wxObject}{wxdc}\wxheading{Include files}<wx/dcprint.h>\wxheading{See also}\helpref{Printing framework overview}{printingoverview}, \helpref{wxDC}{wxdc}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxPrinterDC::wxPrinterDC}\label{wxprinterdcctor}\func{}{wxPrinterDC}{\param{const wxPrintData\& }{printData}}Constructor. Pass a \helpref{wxPrintData}{wxprintdata} object with informationnecessary for setting up a suitable printer device context. Thisis the recommended way to construct a wxPrinterDC.  Make sure you specify a reference to a \helpref{wxPrintData}{wxprintdata} object,not a pointer - you may not even get a warning if you pass a pointerinstead.\func{}{wxPrinterDC}{\param{const wxString\& }{driver}, \param{const wxString\& }{device}, \param{const wxString\& }{output}, \param{const bool }{interactive = true}, \param{int }{orientation = wxPORTRAIT}}Constructor. With empty strings for the first three arguments, the default printer dialog isdisplayed. {\it device} indicates the type of printer and {\it output}is an optional file for printing to. The {\it driver} parameter iscurrently unused.  Use the {\it Ok} member to test whether theconstructor was successful in creating a usable device context.This constructor is deprecated and retained only for backward compatibility.\membersection{wxPrinterDC::GetPaperRect}\label{wxprinterdcgetpaperrect}\func{wxRect}{wxPrinterDC::GetPaperRect}{}Return the rectangle in device coordinates that corresponds to the full paperarea, including the nonprinting regions of the paper. The point (0,0) in devicecoordinates is the top left corner of the page rectangle, which is the printablearea on MSW and Mac. The coordinates of the top left corner of the paperrectangle will therefore have small negative values, while the bottom rightcoordinates will be somewhat larger than the values returned by\helpref{wxDC::GetSize}{wxdcgetsize}.\section{\class{wxPrintout}}\label{wxprintout}This class encapsulates the functionality of printing out an applicationdocument. A new class must be derived and members overridden to respond to callssuch as OnPrintPage and HasPage and to render the print image onto an associated\helpref{wxDC}{wxdc}. Instances of this class are passed to wxPrinter::Print orto a wxPrintPreview object to initiate printing or previewing.Your derived wxPrintout is responsible for drawing both the preview image andthe printed page. If your windows' drawing routines accept an arbitrary DC as anargument, you can re-use those routines within your wxPrintout subclass to drawthe printout image. You may also add additional drawing elements within yourwxPrintout subclass, like headers, footers, and/or page numbers. However, theimage on the printed page will often differ from the image drawn on the screen,as will the print preview image -- not just in the presence of headers andfooters, but typically in scale. A high-resolution printer presents a muchlarger drawing surface (i.e., a higher-resolution DC); a zoomed-out previewimage presents a much smaller drawing surface (lower-resolution DC). By usingthe routines FitThisSizeToXXX() and/or MapScreenSizeToXXX() within yourwxPrintout subclass to set the user scale and origin of the associated DC, youcan easily use a single drawing routine to draw on your application's windows,to create the print preview image, and to create the printed paper image, andachieve a common appearance to the preview image and the printed page.\wxheading{Derived from}\helpref{wxObject}{wxobject}\wxheading{Include files}<wx/print.h>\wxheading{See also}\helpref{Printing framework overview}{printingoverview}, \helpref{wxPrinterDC}{wxprinterdc}, \helpref{wxPrintDialog}{wxprintdialog}, \helpref{wxPageSetupDialog}{wxpagesetupdialog}, \helpref{wxPrinter}{wxprinter}, \helpref{wxPrintPreview}{wxprintpreview}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxPrintout::wxPrintout}\label{wxprintoutctor}\func{}{wxPrintout}{\param{const wxString\& }{title = "Printout"}}Constructor. Pass an optional title argument - the current filename would be a good idea. This will appear in the printing list(at least in MSW)\membersection{wxPrintout::\destruct{wxPrintout}}\label{wxprintoutdtor}\func{}{\destruct{wxPrintout}}{\void}Destructor.\membersection{wxPrintout::GetDC}\label{wxprintoutgetdc}\func{wxDC *}{GetDC}{\void}Returns the device context associated with the printout (given to the printout at start ofprinting or previewing). This will be a wxPrinterDC if printing under Windows or Mac,a wxPostScriptDC if printing on other platforms, and a wxMemoryDC if previewing.\membersection{wxPrintout::GetPageInfo}\label{wxprintoutgetpageinfo}\func{void}{GetPageInfo}{\param{int *}{minPage}, \param{int *}{maxPage}, \param{int *}{pageFrom}, \param{int *}{pageTo}}Called by the framework to obtain information from the application about minimumand maximum page values that the user can select, and the required page range tobe printed. By default this returns 1, 32000 for the page minimum and maximumvalues, and 1, 1 for the required page range.If {\it minPage} is zero, the page number controls in the print dialog will be disabled.\pythonnote{When this method is implemented in a derived Python class,it should be designed to take no parameters (other than the selfreference) and to return a tuple of four integers.}\perlnote{When this method is overridden in a derived class,it must not take any parameters, and returns a 4-element list.}\membersection{wxPrintout::GetPageSizeMM}\label{wxprintoutgetpagesizemm}\func{void}{GetPageSizeMM}{\param{int *}{w}, \param{int *}{h}}Returns the size of the printer page in millimetres.\pythonnote{This method returns the output-only parameters as a tuple.}\perlnote{In wxPerl this method takes no arguments and returns a2-element list {\tt ( w, h )}}\membersection{wxPrintout::GetPageSizePixels}\label{wxprintoutgetpagesizepixels}\func{void}{GetPageSizePixels}{\param{int *}{w}, \param{int *}{h}}Returns the size of the printer page in pixels, called the \em{page rectangle}.The page rectangle has a top left corner at (0,0) and a bottom right corner at(w,h). These values may not be the same as the values returned from\helpref{wxDC::GetSize}{wxdcgetsize}; if the printout is being used forpreviewing, a memory device context is used, which uses a bitmap size reflectingthe current preview zoom. The application must take this discrepancy intoaccount if previewing is to be supported.\pythonnote{This method returns the output-only parameters as a tuple.}\perlnote{In wxPerl this method takes no arguments and returns a2-element list {\tt ( w, h )}}\membersection{wxPrintout::GetPaperRectPixels}\label{wxprintoutgetpaperrectpixels}\func{wxRect}{GetPaperRectPixels}{}Returns the rectangle that corresponds to the entire paper in pixels, called the\em{paper rectangle}. This distinction between paper rectangle and pagerectangle reflects the fact that most printers cannot print all the way to theedge of the paper. The page rectangle is a rectangle whose top left corner is at(0,0) and whose width and height are given by\helpref{wxDC::GetPageSizePixels}{wxprintoutgetpagesizepixels}. On MSW and Mac,the page rectangle gives the printable area of the paper, while the paperrectangle represents the entire paper, including non-printable borders. Thus,the rectangle returned by GetPaperRectPixels will have a top left corner whosecoordinates are small negative numbers and the bottom right corner will havevalues somewhat larger than the width and height given by\helpref{wxDC::GetPageSizePixels}{wxprintoutgetpagesizepixels}. On otherplatforms and for PostScript printing, the paper is treated as if its entirearea were printable, so this function will return the same rectangle as the pagerectangle.\membersection{wxPrintout::GetPPIPrinter}\label{wxprintoutgetppiprinter}\func{void}{GetPPIPrinter}{\param{int *}{w}, \param{int *}{h}}Returns the number of pixels per logical inch of the printer device context.Dividing the printer PPI by the screen PPI can give a suitable scaling factorfor drawing text onto the printer. Remember to multiply this by a scaling factorto take the preview DC size into account. Or you can just use theFitThisSizeToXXX() and MapScreenSizeToXXX routines below, which do most of thescaling calculations for you.\pythonnote{This method returns the output-only parameters as a tuple.}\perlnote{In wxPerl this method takes no arguments and returns a2-element list {\tt ( w, h )}}\membersection{wxPrintout::GetPPIScreen}\label{wxprintoutgetppiscreen}\func{void}{GetPPIScreen}{\param{int *}{w}, \param{int *}{h}}Returns the number of pixels per logical inch of the screen device context.Dividing the printer PPI by the screen PPI can give a suitable scaling factorfor drawing text onto the printer. If you are doing your own scaling, rememberto multiply this by a scaling factor to take the preview DC size into account.\membersection{wxPrintout::GetTitle}\label{wxprintoutgettitle}\func{wxString}{GetTitle}{\void}Returns the title of the printout\pythonnote{This method returns the output-only parameters as a tuple.}\perlnote{In wxPerl this method takes no arguments and returns a2-element list {\tt ( w, h )}}\membersection{wxPrintout::HasPage}\label{wxprintouthaspage}\func{bool}{HasPage}{\param{int}{ pageNum}}Should be overridden to return true if the document has this page, or falseif not. Returning false signifies the end of the document. By default,HasPage behaves as if the document has only one page.\membersection{wxPrintout::IsPreview}\label{wxprintoutispreview}\func{bool}{IsPreview}{\void}Returns true if the printout is currently being used for previewing.\membersection{wxPrintout::FitThisSizeToPaper}\label{wxprintoutfitthissizetopaper}\func{void}{FitThisSizeToPaper}{\param{const wxSize\& }{imageSize}}Set the user scale and device origin of the wxDC associated with this wxPrintoutso that the given image size fits entirely within the paper and the origin is atthe top left corner of the paper. Note that with most printers, the regionaround the edges of the paper are not printable so that the edges of the imagecould be cut off. Use this if you're managing your own page margins.\membersection{wxPrintout::FitThisSizeToPage}\label{wxprintoutfitthissizetopage}\func{void}{FitThisSizeToPage}{\param{const wxSize\& }{imageSize}}Set the user scale and device origin of the wxDC associated with this wxPrintoutso that the given image size fits entirely within the page rectangle and theorigin is at the top left corner of the page rectangle. On MSW and Mac, the pagerectangle is the printable area of the page. On other platforms and PostScriptprinting, the page rectangle is the entire paper. Use this if you want yourprinted image as large as possible, but with the caveat that on some platforms, portions of the image might be cut off at the edges.\membersection{wxPrintout::FitThisSizeToPageMargins}\label{wxprintoutfitthissizetopagemargins}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -