print.tex
来自「Wxpython Implemented on Windows CE, Sou」· TEX 代码 · 共 1,214 行 · 第 1/3 页
TEX
1,214 行
\param{const bool }{interactive = true}, \param{int }{orientation = wxPORTRAIT}}
Constructor. With empty strings for the first three arguments, the default printer dialog is
displayed. {\it device} indicates the type of printer and {\it output}
is an optional file for printing to. The {\it driver} parameter is
currently unused. Use the {\it Ok} member to test whether the
constructor was successful in creating a usable device context.
This constructor is deprecated and retained only for backward compatibility.
\section{\class{wxPrintout}}\label{wxprintout}
This class encapsulates the functionality of printing out an
application document. A new class must be derived and members
overridden to respond to calls such as OnPrintPage and HasPage.
Instances of this class are passed to wxPrinter::Print or a
wxPrintPreview object to initiate printing or previewing.
\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},\rtfsp
\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 of
printing or previewing). This will be a wxPrinterDC if printing under Windows,
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 minimum and maximum page values that
the user can select, and the required page range to be printed. By default this
returns 1, 32000 for the page minimum and maximum values, 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 self
reference) 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 a
2-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. These may not be the
same as the values returned from \helpref{wxDC::GetSize}{wxdcgetsize} if
the printout is being used for previewing, since in this case, a
memory device context is used, using a bitmap size reflecting the current
preview zoom. The application must take this discrepancy into account 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 a
2-element list {\tt ( w, h )}}
\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
factor for drawing text onto the printer. Remember to multiply
this by a scaling factor to take the preview DC size into account.
\pythonnote{This method returns the output-only parameters as a tuple.}
\perlnote{In wxPerl this method takes no arguments and returns a
2-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
factor for drawing text onto the printer. Remember to 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 a
2-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 false
if 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::OnBeginDocument}\label{wxprintoutonbegindocument}
\func{bool}{OnBeginDocument}{\param{int}{ startPage}, \param{int}{ endPage}}
Called by the framework at the start of document printing. Return false from
this function cancels the print job. OnBeginDocument is called once for every
copy printed.
The base wxPrintout::OnBeginDocument {\it must} be called (and the return value
checked) from within the overridden function, since it calls wxDC::StartDoc.
\pythonnote{If this method is overridden in a Python class then the
base class version can be called by using the method
{\tt base\_OnBeginDocument(startPage, endPage)}. }
\membersection{wxPrintout::OnEndDocument}\label{wxprintoutonenddocument}
\func{void}{OnEndDocument}{\void}
Called by the framework at the end of document printing. OnEndDocument
is called once for every copy printed.
The base wxPrintout::OnEndDocument {\it must} be called
from within the overridden function, since it calls wxDC::EndDoc.
\membersection{wxPrintout::OnBeginPrinting}\label{wxprintoutonbeginprinting}
\func{void}{OnBeginPrinting}{\void}
Called by the framework at the start of printing. OnBeginPrinting is called once for every
print job (regardless of how many copies are being printed).
\membersection{wxPrintout::OnEndPrinting}\label{wxprintoutonendprinting}
\func{void}{OnEndPrinting}{\void}
Called by the framework at the end of printing. OnEndPrinting
is called once for every print job (regardless of how many copies are being printed).
\membersection{wxPrintout::OnPreparePrinting}\label{wxprintoutonprepareprinting}
\func{void}{OnPreparePrinting}{\void}
Called once by the framework before any other demands are made of the
wxPrintout object. This gives the object an opportunity to calculate the
number of pages in the document, for example.
\membersection{wxPrintout::OnPrintPage}\label{wxprintoutonprintpage}
\func{bool}{OnPrintPage}{\param{int}{ pageNum}}
Called by the framework when a page should be printed. Returning false cancels
the print job. The application can use wxPrintout::GetDC to obtain a device
context to draw on.
\section{\class{wxPrintPreview}}\label{wxprintpreview}
Objects of this class manage the print preview process. The object is passed
a wxPrintout object, and the wxPrintPreview object itself is passed to
a wxPreviewFrame object. Previewing is started by initializing and showing
the preview frame. Unlike wxPrinter::Print, flow of control returns to the application
immediately after the frame is shown.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/print.h>
\wxheading{See also}
\overview{Printing framework overview}{printingoverview}, \helpref{wxPrinterDC}{wxprinterdc}, \helpref{wxPrintDialog}{wxprintdialog},\rtfsp
\helpref{wxPrintout}{wxprintout}, \helpref{wxPrinter}{wxprinter},\rtfsp
\helpref{wxPreviewCanvas}{wxpreviewcanvas}, \helpref{wxPreviewControlBar}{wxpreviewcontrolbar},\rtfsp
\helpref{wxPreviewFrame}{wxpreviewframe}.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrintPreview::wxPrintPreview}\label{wxprintpreviewctor}
\func{}{wxPrintPreview}{\param{wxPrintout* }{printout}, \param{wxPrintout* }{printoutForPrinting},
\param{wxPrintData* }{data=NULL}}
Constructor. Pass a printout object, an optional printout object to be
used for actual printing, and the address of an optional
block of printer data, which will be copied to the print preview object's
print data.
If {\it printoutForPrinting} is non-NULL, a {\bf Print...} button will be placed on the
preview frame so that the user can print directly from the preview interface.
Do not explicitly delete the printout objects once this destructor has been
called, since they will be deleted in the wxPrintPreview constructor.
The same does not apply to the {\it data} argument.
Test the Ok member to check whether the wxPrintPreview object was created correctly.
Ok could return false if there was a problem initializing the printer device context
(current printer not set, for example).
\membersection{wxPrintPreview::\destruct{wxPrintPreview}}\label{wxprintpreviewdtor}
\func{}{\destruct{wxPrinter}}{\void}
Destructor. Deletes both print preview objects, so do not destroy these objects
in your application.
\membersection{wxPrintPreview::GetCanvas}\label{wxprintpreviewgetcanvas}
\func{wxPreviewCanvas* }{GetCanvas}{\void}
Gets the preview window used for displaying the print preview image.
\membersection{wxPrintPreview::GetCurrentPage}\label{wxprintpreviewgetcurrentpage}
\func{int}{GetCurrentPage}{\void}
Gets the page currently being previewed.
\membersection{wxPrintPreview::GetFrame}\label{wxprintpreviewgetframe}
\func{wxFrame *}{GetFrame}{\void}
Gets the frame used for displaying the print preview canvas
and control bar.
\membersection{wxPrintPreview::GetMaxPage}\label{wxprintpreviewgetmaxpage}
\func{int}{GetMaxPage}{\void}
Returns the maximum page number.
\membersection{wxPrintPreview::GetMinPage}\label{wxprintpreviewgetminpage}
\func{int}{GetMinPage}{\void}
Returns the minimum page number.
\membersection{wxPrintPreview::GetPrintout}\label{wxprintpreviewgetprintout}
\func{wxPrintout *}{GetPrintout}{\void}
Gets the preview printout object associated with the wxPrintPreview object.
\membersection{wxPrintPreview::GetPrintoutForPrinting}\label{wxprintpreviewgetprintoutforprinting}
\func{wxPrintout *}{GetPrintoutForPrinting}{\void}
Gets the printout object to be used for printing from within the preview interface,
or NULL if none exists.
\membersection{wxPrintPreview::Ok}\label{wxprintpreviewok}
\func{bool}{Ok}{\void}
Returns true if the wxPrintPreview is valid, false otherwise. It could return false if there was a
problem initializing the printer device context (current printer not set, for example).
\membersection{wxPrintPreview::PaintPage}\label{wxprintpreviewpaintpage}
\func{bool}{PaintPage}{\param{wxPreviewCanvas *}{canvas}, \param{wxDC& }{dc}}
This refreshes the preview window with the preview image.
It must be called from the preview window's OnPaint member.
The implementation simply blits the preview bitmap onto
the canvas, creating a new preview bitmap if none exists.
\membersection{wxPrintPreview::Print}\label{wxprintpreviewprint}
\func{bool}{Print}{\param{bool }{prompt}}
Invokes the print process using the second wxPrintout object
supplied in the wxPrintPreview constructor.
Will normally be called by the {\bf Print...} panel item on the
preview frame's control bar.
Returns false in case of error -- call
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
information about the kind of the error.
\membersection{wxPrintPreview::RenderPage}\label{wxprintpreviewrenderpage}
\func{bool}{RenderPage}{\param{int }{pageNum}}
Renders a page into a wxMemoryDC. Used internally by wxPrintPreview.
\membersection{wxPrintPreview::SetCanvas}\label{wxprintpreviewsetcanvas}
\func{void}{SetCanvas}{\param{wxPreviewCanvas* }{window}}
Sets the window to be used for displaying the print preview image.
\membersection{wxPrintPreview::SetCurrentPage}\label{wxprintpreviewsetcurrentpage}
\func{void}{SetCurrentPage}{\param{int}{ pageNum}}
Sets the current page to be previewed.
\membersection{wxPrintPreview::SetFrame}\label{wxprintpreviewsetframe}
\func{void}{SetFrame}{\param{wxFrame *}{frame}}
Sets the frame to be used for displaying the print preview canvas
and control bar.
\membersection{wxPrintPreview::SetPrintout}\label{wxprintpreviewsetprintout}
\func{void}{SetPrintout}{\param{wxPrintout *}{printout}}
Associates a printout object with the wxPrintPreview object.
\membersection{wxPrintPreview::SetZoom}\label{wxprintpreviewsetzoom}
\func{void}{SetZoom}{\param{int}{ percent}}
Sets the percentage preview zoom, and refreshes the preview canvas
accordingly.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?