📄 dc.tex
字号:
\rtfsp{\it string} is the text string to measure, {\it descent} is thedimension from the baseline of the font to the bottom of thedescender, and {\it externalLeading} is any extra vertical space addedto the font by the font designer (usually is zero).The text extent is returned in {\it w} and {\it h} pointers (first form) or asa \helpref{wxSize}{wxsize} object (second form).If the optional parameter {\it font} is specified and valid, then it is usedfor the text extent calculation. Otherwise the currently selected font is.Note that this function only works with single-line strings.\wxheading{See also}\helpref{wxFont}{wxfont},\rtfsp\helpref{wxDC::SetFont}{wxdcsetfont},\rtfsp\helpref{wxDC::GetPartialTextExtents}{wxdcgetpartialtextextents},\rtfsp\helpref{wxDC::GetMultiLineTextExtent}{wxdcgetmultilinetextextent}\pythonnote{The following methods are implemented in wxPython:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf GetTextExtent(string)}}{Returns a 2-tuple, (width, height)}\twocolitem{{\bf GetFullTextExtent(string, font=NULL)}}{Returns a4-tuple, (width, height, descent, externalLeading) }\end{twocollist}}}\perlnote{In wxPerl this method is implemented as {\bf GetTextExtent( string, font = undef )} returning a four element array {\tt ( width, height, descent, externalLeading )}}\membersection{wxDC::GetTextForeground}\label{wxdcgettextforeground}\constfunc{const wxColour\&}{GetTextForeground}{\void}Gets the current text foreground colour (see \helpref{wxDC::SetTextForeground}{wxdcsettextforeground}).\membersection{wxDC::GetUserScale}\label{wxdcgetuserscale}\func{void}{GetUserScale}{\param{double}{ *x}, \param{double}{ *y}}Gets the current user scale factor (set by \helpref{SetUserScale}{wxdcsetuserscale}).\perlnote{In wxPerl this method takes no arguments and return a two element array {\tt ( x, y )}}\membersection{wxDC::GradientFillConcentric}\label{wxdcgradientfillconcentric}\func{void}{GradientFillConcentric}{\param{const wxRect\&}{ rect}, \param{const wxColour\&}{ initialColour}, \param{const wxColour\&}{ destColour}}\func{void}{GradientFillConcentric}{\param{const wxRect\&}{ rect}, \param{const wxColour\&}{ initialColour}, \param{const wxColour\&}{ destColour}, \param{const wxPoint\& }{circleCenter}}Fill the area specified by rect with a radial gradient, starting from \arg{initialColour} at the centre of the circle and fading to \arg{destColour} on the circle outside.\arg{circleCenter} are the relative coordinates of centre of the circle inthe specified \arg{rect}. If not specified, the cercle is placed at thecentre of rect.\textbf{Note: } Currently this function is very slow, don't use it forreal-time drawing.\membersection{wxDC::GradientFillLinear}\label{wxdcgradientfilllinear}\func{void}{GradientFillLinear}{\param{const wxRect\&}{ rect}, \param{const wxColour\&}{ initialColour}, \param{const wxColour\&}{ destColour}, \param{wxDirection}{ nDirection = wxEAST}}Fill the area specified by \arg{rect} with a linear gradient, starting from \arg{initialColour} and eventually fading to \arg{destColour}. The \arg{nDirection} specifies the direction of the colour change, default is touse \arg{initialColour} on the left part of the rectangle and \arg{destColour} on the right one.\membersection{wxDC::LogicalToDeviceX}\label{wxdclogicaltodevicex}\func{wxCoord}{LogicalToDeviceX}{\param{wxCoord}{ x}}Converts logical X coordinate to device coordinate, using the currentmapping mode.\membersection{wxDC::LogicalToDeviceXRel}\label{wxdclogicaltodevicexrel}\func{wxCoord}{LogicalToDeviceXRel}{\param{wxCoord}{ x}}Converts logical X coordinate to relative device coordinate, using the currentmapping mode but ignoring the x axis orientation.Use this for converting a width, for example.\membersection{wxDC::LogicalToDeviceY}\label{wxdclogicaltodevicey}\func{wxCoord}{LogicalToDeviceY}{\param{wxCoord}{ y}}Converts logical Y coordinate to device coordinate, using the currentmapping mode.\membersection{wxDC::LogicalToDeviceYRel}\label{wxdclogicaltodeviceyrel}\func{wxCoord}{LogicalToDeviceYRel}{\param{wxCoord}{ y}}Converts logical Y coordinate to relative device coordinate, using the currentmapping mode but ignoring the y axis orientation.Use this for converting a height, for example.\membersection{wxDC::MaxX}\label{wxdcmaxx}\func{wxCoord}{MaxX}{\void}Gets the maximum horizontal extent used in drawing commands so far.\membersection{wxDC::MaxY}\label{wxdcmaxy}\func{wxCoord}{MaxY}{\void}Gets the maximum vertical extent used in drawing commands so far.\membersection{wxDC::MinX}\label{wxdcminx}\func{wxCoord}{MinX}{\void}Gets the minimum horizontal extent used in drawing commands so far.\membersection{wxDC::MinY}\label{wxdcminy}\func{wxCoord}{MinY}{\void}Gets the minimum vertical extent used in drawing commands so far.\membersection{wxDC::IsOk}\label{wxdcisok}\func{bool}{Ok}{\void}Returns true if the DC is ok to use.\membersection{wxDC::ResetBoundingBox}\label{wxdcresetboundingbox}\func{void}{ResetBoundingBox}{\void}Resets the bounding box: after a call to this function, the bounding boxdoesn't contain anything.\wxheading{See also}\helpref{CalcBoundingBox}{wxdccalcboundingbox}\membersection{wxDC::SetAxisOrientation}\label{wxdcsetaxisorientation}\func{void}{SetAxisOrientation}{\param{bool}{ xLeftRight}, \param{bool}{ yBottomUp}}Sets the x and y axis orientation (i.e., the direction from lowest tohighest values on the axis). The default orientation is x axis from left to right and y axis from top down.\wxheading{Parameters}\docparam{xLeftRight}{True to set the x axis orientation to the naturalleft to right orientation, false to invert it.}\docparam{yBottomUp}{True to set the y axis orientation to the naturalbottom up orientation, false to invert it.}\membersection{wxDC::SetBackground}\label{wxdcsetbackground}\func{void}{SetBackground}{\param{const wxBrush\& }{brush}}Sets the current background brush for the DC.\membersection{wxDC::SetBackgroundMode}\label{wxdcsetbackgroundmode}\func{void}{SetBackgroundMode}{\param{int}{ mode}}{\it mode} may be one of wxSOLID and wxTRANSPARENT. This setting determineswhether text will be drawn with a background colour or not.\membersection{wxDC::SetBrush}\label{wxdcsetbrush}\func{void}{SetBrush}{\param{const wxBrush\& }{brush}}Sets the current brush for the DC.If the argument is wxNullBrush, the current brush is selected out of the devicecontext, and the original brush restored, allowing the current brush tobe destroyed safely.See also \helpref{wxBrush}{wxbrush}.See also \helpref{wxMemoryDC}{wxmemorydc} for the interpretation of colourswhen drawing into a monochrome bitmap. \membersection{wxDC::SetClippingRegion}\label{wxdcsetclippingregion}\func{void}{SetClippingRegion}{\param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{wxCoord}{ width}, \param{wxCoord}{ height}}\func{void}{SetClippingRegion}{\param{const wxPoint\& }{pt}, \param{const wxSize\& }{sz}}\func{void}{SetClippingRegion}{\param{const wxRect\&}{ rect}}\func{void}{SetClippingRegion}{\param{const wxRegion\&}{ region}}Sets the clipping region for this device context to the intersection of thegiven region described by the parameters of this method and the previously setclipping region. You should call \helpref{DestroyClippingRegion}{wxdcdestroyclippingregion} if you want to setthe clipping region exactly to the region specified.The clipping region is an area to which drawing is restricted. Possible usesfor the clipping region are for clipping text or for speeding up window redrawswhen only a known area of the screen is damaged.\wxheading{See also}\helpref{wxDC::DestroyClippingRegion}{wxdcdestroyclippingregion}, \helpref{wxRegion}{wxregion}\membersection{wxDC::SetDeviceOrigin}\label{wxdcsetdeviceorigin}\func{void}{SetDeviceOrigin}{\param{wxCoord}{ x}, \param{wxCoord}{ y}}Sets the device origin (i.e., the origin in pixels after scaling has beenapplied).This function may be useful in Windows printingoperations for placing a graphic on a page.\membersection{wxDC::SetFont}\label{wxdcsetfont}\func{void}{SetFont}{\param{const wxFont\& }{font}}Sets the current font for the DC. It must be a valid font, in particular youshould not pass {\tt wxNullFont} to this method.See also \helpref{wxFont}{wxfont}.\membersection{wxDC::SetLayoutDirection}\label{wxdcsetlayoutdirection}\func{void}{SetLayoutDirection}{\param{wxLayoutDirection}{ dir}}Sets the current layout direction for the device context. \arg{dir} may be either\texttt{wxLayout\_Default}, \texttt{wxLayout\_LeftToRight} or \texttt{wxLayout\_RightToLeft}.\wxheading{See also}\helpref{GetLayoutDirection}{wxdcgetlayoutdirection}\membersection{wxDC::SetLogicalFunction}\label{wxdcsetlogicalfunction}\func{void}{SetLogicalFunction}{\param{int}{ function}}Sets the current logical function for the device context. This determines howa source pixel (from a pen or brush colour, or source device context ifusing \helpref{wxDC::Blit}{wxdcblit}) combines with a destination pixel in thecurrent device context.The possible valuesand their meaning in terms of source and destination pixel values areas follows:\begin{verbatim}wxAND src AND dstwxAND_INVERT (NOT src) AND dstwxAND_REVERSE src AND (NOT dst)wxCLEAR 0wxCOPY srcwxEQUIV (NOT src) XOR dstwxINVERT NOT dstwxNAND (NOT src) OR (NOT dst)wxNOR (NOT src) AND (NOT dst)wxNO_OP dstwxOR src OR dstwxOR_INVERT (NOT src) OR dstwxOR_REVERSE src OR (NOT dst)wxSET 1wxSRC_INVERT NOT srcwxXOR src XOR dst\end{verbatim}The default is wxCOPY, which simply draws with the current colour.The others combine the current colour and the background using alogical operation. wxINVERT is commonly used for drawing rubber bands ormoving outlines, since drawing twice reverts to the original colour.\membersection{wxDC::SetMapMode}\label{wxdcsetmapmode}\func{void}{SetMapMode}{\param{int}{ int}}The {\it mapping mode} of the device context defines the unit ofmeasurement used to convert logical units to device units. Note thatin X, text drawing isn't handled consistently with the mapping mode; afont is always specified in point size. However, setting the {\ituser scale} (see \helpref{wxDC::SetUserScale}{wxdcsetuserscale}) scales the text appropriately. InWindows, scalable TrueType fonts are always used; in X, results dependon availability of fonts, but usually a reasonable match is found.The coordinate origin is always at the top left of the screen/printer.Drawing to a Windows printer device context uses the current mapping mode,but mapping mode is currently ignored for PostScript output.The mapping mode can be one of the following:\begin{twocollist}\itemsep=0pt\twocolitem{wxMM\_TWIPS}{Each logical unit is 1/20 of a point, or 1/1440 of an inch.}\twocolitem{wxMM\_POINTS}{Each logical unit is a point, or 1/72 of an inch.}\twocolitem{wxMM\_METRIC}{Each logical unit is 1 mm.}\twocolitem{wxMM\_LOMETRIC}{Each logical unit is 1/10 of a mm.}\twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.}\end{twocollist}\membersection{wxDC::SetPalette}\label{wxdcsetpalette}\func{void}{SetPalette}{\param{const wxPalette\& }{palette}}If this is a window DC or memory DC, assigns the given palette to the windowor bitmap associated with the DC. If the argument is wxNullPalette, the currentpalette is selected out of the device context, and the original paletterestored.See \helpref{wxPalette}{wxpalette} for further details. \membersection{wxDC::SetPen}\label{wxdcsetpen}\func{void}{SetPen}{\param{const wxPen\& }{pen}}Sets the current pen for the DC.If the argument is wxNullPen, the current pen is selected out of the devicecontext, and the original pen restored.See also \helpref{wxMemoryDC}{wxmemorydc} for the interpretation of colourswhen drawing into a monochrome bitmap.\membersection{wxDC::SetTextBackground}\label{wxdcsettextbackground}\func{void}{SetTextBackground}{\param{const wxColour\& }{colour}}Sets the current text background colour for the DC.\membersection{wxDC::SetTextForeground}\label{wxdcsettextforeground}\func{void}{SetTextForeground}{\param{const wxColour\& }{colour}}Sets the current text foreground colour for the DC.See also \helpref{wxMemoryDC}{wxmemorydc} for the interpretation of colourswhen drawing into a monochrome bitmap.\membersection{wxDC::SetUserScale}\label{wxdcsetuserscale}\func{void}{SetUserScale}{\param{double}{ xScale}, \param{double}{ yScale}}Sets the user scaling factor, useful for applications which require`zooming'.\membersection{wxDC::StartDoc}\label{wxdcstartdoc}\func{bool}{StartDoc}{\param{const wxString\& }{message}}Starts a document (only relevant when outputting to a printer).Message is a message to show while printing.\membersection{wxDC::StartPage}\label{wxdcstartpage}\func{bool}{StartPage}{\void}Starts a document page (only relevant when outputting to a printer).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -