A Device Context. Encapsulates an MFC CDC
class.
-
Aborts a print job
-
Draws an arc.
-
Opens a path bracket in the device context
-
Copies a bitmap
-
Draws a chord.
-
Creates a memory DC compatible with this DC.
-
Creates a device context for a specific printer
-
Deletes all resources associated with a device context.
-
Convert from device points to logical points.
-
Draws a three-dimensional rectangle.
-
Draws a rectangle in the style used to indicate the rectangle has focus
-
Draws a frame control of the specified type and style.
-
Draws an icon on the DC.
-
Formats text in the given rectangle
-
Draws an Ellipse.
-
Finishes spooling the document and starts printing it
-
Finishes a page on a printer DC
-
Closes a path bracket and selects the path defined by the bracket into the specified device context
-
Writes text to the DC.
-
Closes any open figures in the current path and fills the path's interior by using the current brush and polygon-filling mode.
-
Fills a given rectangle with the specified brush
-
Fills the given rectangle with the specified solid color.
-
Draws a border around the rectangle specified by rect
-
Retrieves the origin (in device units) of the brush currently selected for the device context.
-
Retrives the current clipping region.
-
Retrieves the current position (in logical coordinates).
-
Retrieves current device capabilities.
-
Retrieves the handle of the attribute device context.
-
Retrieves the handle of the output device context.
-
Gets the mapping mode for the device context.
-
Returns the closest color a device can map.
-
Returns the value of a pixel at a location
-
Returns the underlying windows handle for the DC object.
-
Calculates the size of the string.
-
Alias for GetTextExtent - Calculates the size of the string.
-
Retrieves the name of the current font.
-
Retrieves the metrics for the current font.
-
Gets the viewport extent of the device context
-
Gets the viewport origin of the device context
-
Gets the window extent of the device context
-
Retrieves the x- and y-coordinates of the origin of the window associated with the device context.
-
Creates a new clipping region by forming the intersection of the current region and the rectangle specified
-
Returns 1 if the DC is currently printing, else 0
-
Draws a line to a specified point.
-
Convert from logical points to device points
-
Moves the current position to a specifed point.
-
Modifies the coordinates of the window origin relative to the coordinates of the current window origin.
-
Modifies the coordinates of the viewport origin relative to the coordinates of the current viewport origin
-
Creates a bit pattern on the device.
-
Draws a pie shape with specific starting and ending points in a rectangle
-
Draws one or more Bezier splines.
-
Draws an Polygon.
-
Draws a Polyline.
-
Maps palette entries in the current logical palette to the system palette.
-
Draws a rectangle using the current pen. The interior of the rectangle is filled using the current brush.
-
Determines if a rectangle is currently visisble in the viewport.
-
Restores a saved DC.
-
Saves a DC.
-
Modifies the window extents relative to the current values.
-
Modifies the viewport extents relative to the current values.
-
Selects the given region as the current clipping region for the device context
-
Selects an object into the DC.
-
Selects the logical palette.
-
Sets the background color.
-
Sets the background mode.
-
Specifies the origin that GDI will assign to the next brush that the application selects into the device context.
-
Sets the graphics mode for the specified device context
-
Sets the device mapping mode.
-
Set a pixel to a color
-
Sets the polygon-filling mode.
-
Sets the current drawing mode.
-
Sets the text alignment.
-
Sets the text foreground color.
-
Sets the extents of the window.
-
Sets the window origin of the device context
-
Sets the extents of the window's viewport.
-
Sets the viewport origin of the device context
-
sets a two-dimensional linear transformation between world space and page space for the specified device context.
-
Starts spooling a document to a printer DC
-
Starts a new page on a printer DC
-
Copies a bitmap from the source device context to this device context.
-
Closes any open figures in a path, strokes the outline of the path by using the current pen, and fills its interior by using the current brush. The device context must contain a closed path.
-
Renders the specified path by using the current pen.
-
Writes text to the DC.
PyCDC.AbortDoc
AbortDoc() Aborts a print job
PyCDC.Arc
Arc(rect, pointStart, pointEnd) Draws an eliptical arc.
-
rect : (left, top, right, bottom)
Specifies the ellipse's bounding rectangle
-
pointStart : (x,y)
Specifies the x- and y-coordinates
of the point that defines the arc's starting point (in logical units).
This point does not have to lie exactly on the arc.
-
pointEnd : (x,y)
Specifies the x- and y-coordinates
of the point that defines the arc's ending point (in logical units).
This point does not have to lie exactly on the arc.
The arc drawn by using the function is a segment of the ellipse defined by the specified bounding rectangle.
The actual starting point of the arc is the point at which a ray drawn
from the center of the bounding rectangle through the specified starting
point intersects the ellipse. The actual ending point of the arc is the
point at which a ray drawn from the center of the bounding rectangle through
the specified ending point intersects the ellipse. The arc is drawn in a
counterclockwise direction. Since an arc is not a closed figure, it is
not filled. Both the width and height of the rectangle must be greater
than 2 units and less than 32,767 units.
- CDC::Arc
Always none. If the function fails, an exception is raised.
PyCDC.BeginPath
BeginPath() Opens a path bracket in the device context
PyCDC.BitBlt
BitBlt(destPos, size, dc, srcPos, rop) Copies a bitmap from the source device context to this device context.
-
destPos : (x,y)-ints
The logical x,y coordinates of the upper-left corner of the destination rectangle.
-
size : (width, height)-ints
Specifies the width and height (in logical units) of the destination rectangle and source bitmap.
-
dc : PyCDC
Specifies the PyCDC object from which the bitmap will be copied. It must be None if rop specifies a raster operation that does not include a source.
-
srcPos : (xSrc, ySrc)-ints
Specifies the logical x,y coordinates of the upper-left corner of the source bitmap.
-
rop : int
Specifies the raster operation to be performed. See the win32 api documentation for details.
- CDC::BitBlt
PyCDC.Chord
Chord(rect, pointStart, pointEnd) Draws a chord.
-
rect : (left, top, right, bottom)
Specifies the ellipse's bounding rectangle
-
pointStart : (x,y)
Specifies the x- and y-coordinates
of the point that defines the arc's starting point (in logical units).
This point does not have to lie exactly on the arc.
-
pointEnd : (x,y)
Specifies the x- and y-coordinates
of the point that defines the arc's ending point (in logical units).
This point does not have to lie exactly on the arc.
Draws a chord (a closed figure bounded by the intersection
of an ellipse and a line segment). The rect parameter specify the
upper-left and lower-right corners, respectively, of a rectangle
bounding the ellipse that is part of the chord.
The pointStart and pointEnd parameters specify
the endpoints of a line that intersects the ellipse.
The chord is drawn by using the selected pen and filled
by using the selected brush.
- CDC::Chord
Always none. If the function fails, an exception is raised.
PyCDC.CreateCompatibleDC
CreateCompatibleDC(dcFrom) Creates a memory device context that is compatible with this DC.
-
dcFrom=None : PyCDC
The source DC, or None to make a screen compatible DC.
Note that unlike the MFC version, this function
calls the global CreateCompatibleDC function and returns
a new PyCDC object.
- CDC::CreateCompatibleDC
PyCDC.CreatePrinterDC
CreatePrinterDC(printerName) Creates a device context for a specific printer
-
printerName=None : string
The printer name, or None for the default printer
- CDC::CreateDC
PyCDC.DPtoLP
(x,y) = DPtoLP(point) Converts device units into logical units.
-
point : (x,y)
The point to convert
-
x
The x coordinate to convert.
-
y
The y coordinate to convert.
- CDC::DPtoLP
Should really handle list of (x,y) points
The converted coordinates.
PyCDC.DeleteDC
DeleteDC() Deletes all resources associated with a device context.
In general, do not call this function; the destructor will do it for you.
An application should not call DeleteDC if objects have been selected into the device context. Objects must first be selected out of the device context before it it is deleted.
An application must not delete a device context whose handle was obtained by calling CWnd::GetDC. Instead, it must call CWnd::ReleaseDC to free the device context.
The DeleteDC function is generally used to delete device contexts created with CreateDC, CreateIC, or CreateCompatibleDC.
PyCDC.Draw3dRect
Draw3dRect(rect, colorTopLeft, colorBotRight) Draws a three-dimensional rectangle.
-
rect : (left, top, right, bottom
Specifies the bounding rectangle, in logical units.
-
colorTopLeft : int
Specifies the color of the top and left sides of the three-dimensional rectangle.
-
colorBotRight : int
Specifies the color of the bottom and right sides of the three-dimensional rectangle.
- CDC::Draw3dRect
PyCDC.DrawFocusRect
DrawFocusRect(rect) Draws a rectangle in the style used to
indicate the rectangle has focus
-
rect : (left, top, right, bottom)
The coordinates of the
rectangle
- CDC::DrawFocusRect
PyCDC.DrawFrameControl
DrawFrameControl(rect, typ, state) Draws a frame control of the specified type and style.
-
rect : (left, top, right, bottom)
Specifies the bounding rectangle, in logical units.
-
typ : int
-
state : int
- CDC::DrawFrameControl
PyCDC.DrawIcon
DrawIcon(point, hIcon) Draws an icon on the DC.
-
point : (x,y)
The point coordinate to draw to.
-
hIcon : PyHANDLE
The handle of the icon to draw.
- CDC::DrawIcon
PyCDC.DrawText
s,rc,forat = DrawText(s, tuple
, format
) Formats text in the given rectangle
-
s : string
The desired output string
-
tuple : (int, int, int, int)
The bounding rectangle in the form:
(left, top, right, bottom) expressed in logical units (depending on
selected coordinate system - see PyCDC::SetMapMode)
-
format : int
Specifies one or more bit-or'd format values, such as
DT_BOTTOM, DT_CENTERDT_RIGHT, DT_VCENTER. For a complete list, see
the Microsoft Win32 API documentation.
Example
import win32ui<nl>
import win32con<nl>
INCH = 1440 # twips - 1440 per inch allows fine res<nl>
def drawtext_test():<nl>
dc = win32ui\.CreateDC\(\)<nl>
dc\.CreatePrinterDC\(\) \# ties to default printer<nl>
dc\.StartDoc\('My Python Document'\)<nl>
dc\.StartPage\(\)<nl>
<nl>
\# note: upper left is 0,0 with x increasing to the right,<nl>
\# and y decreasing \(negative\) moving down<nl>
dc\.SetMapMode\(win32con\.MM\_TWIPS\)<nl>
<nl>
\# Centers "TEST" about an inch down on page<nl>
dc\.DrawText\('TEST', \(0,INCH\*-1,INCH\*8,INCH\*-2\), win32con\.DT\_CENTER \)<nl>
dc\.EndPage\(\)<nl>
dc\.EndDoc\(\)<nl>
del dc<nl>
Height of text in pixels
The return value is the height of the text, in logical units.
If DT_VCENTER or DT_BOTTOM is specified, the return value is the
offset from rect.top to the bottom of the drawn text.
If the function fails, the return value is zero (no Python exception is thrown)
PyCDC.Ellipse
Ellipse(rect) Draws an Ellipse.
-
rect : (left, top, right, bottom)
Specifies the ellipse's bounding rectangle
The center of the ellipse is the center of the bounding rectangle
specified by rect. The ellipse is drawn with the current pen, and its
interior is filled with the current brush.
- CDC::Ellipse
Always none. If the function fails, an exception is raised.
PyCDC.EndDoc
EndDoc() Finishes spooling the document and starts printing it
PyCDC.EndPage
EndPage() Finishes a page on a printer DC
PyCDC.EndPath
EndPath() Closes a path bracket and selects the path defined by the bracket into the specified device context
PyCDC.ExtTextOut
ExtTextOut(int, int, int, rect, string, tuple) Writes text to the DC.
-
int : x
The x coordinate to write the text to.
-
int : y
The y coordinate to write the text to.
-
int : nOptions
Specifies the rectangle type. This parameter can be one, both, or neither of ETO_CLIPPED and ETO_OPAQUE
-
rect : (left, top, right, bottom)
Specifies the text's bounding rectangle. (Can be None.)
-
string : text
The text to write.
-
tuple : (width1, width2, ...)
Optional array of values that indicate distance between origins of character cells.
- CDC::ExtTextOut
Always none. If the function fails, an exception is raised.
PyCDC.FillPath
FillPath() Closes any open figures in the current path and fills the path's interior by using the current brush and polygon-filling mode. After its interior is filled, the path is discarded from the device context.
PyCDC.FillRect
FillRect(rect, brush) Fills a given rectangle with the specified brush
-
rect : (left, top, right, bottom
Specifies the bounding rectangle, in logical units.
-
brush : PyCBrush
Specifies the brush to use.
- CDC::FillRect
PyCDC.FillSolidRect
FillSolidRect(rect, color) Fills the given rectangle with the specified solid color.
-
rect : (left, top, right, bottom
Specifies the bounding rectangle, in logical units.
-
color : int
Specifies the color to use.
- CDC::FillSolidRect
PyCDC.FrameRect
FrameRect(rect, brush) Draws a border around the rectangle specified by rect
-
rect : (left, top, right, bottom
Specifies the bounding rectangle, in logical units.
-
brush : PyCBrush
Specifies the brush to use.
- CDC::FrameRect
PyCDC.GetBrushOrg
(int,int) = GetBrushOrg() Retrieves the origin (in device units) of the brush currently selected for the device context.
- CDC::GetBrushOrg
PyCDC.GetClipBox
(left, top, right, bottom) = GetClipBox() Retrieves the dimensions of the smallest bounding rectangle around the current clipping boundary.
- CDC::GetClipBox
A tuple of integers specifying the rectangle.
PyCDC.GetCurrentPosition
(x, y) = GetCurrentPosition() Retrieves the current position (in logical coordinates).
PyCDC.GetDeviceCaps
int = GetDeviceCaps(index) Retrieves a capability of the device context.
-
index : int
The information requested. See the win32api documentation for details.
- CDC::GetDeviceCaps
The value of the requested capability
PyCDC.GetHandleAttrib
int = GetHandleAttrib() Retrieves the handle of the attribute device context.
PyCDC.GetHandleOutput
int = GetHandleOutput() Retrieves the handle of the output device context.
PyCDC.GetMapMode
int = GetMapMode() Gets the mapping mode for the device context.
- CDC::GetMapMode
PyCDC.GetNearestColor
int = GetNearestColor(color) Returns the closest color a device can map.
-
color : int
Specifies the color to be matched.
PyCDC.GetPixel
GetPixel(x, y) Gets a pixel at a local in a device context
-
x : int
Horizontal coordinate.
-
y : int
Vertical coordinate.
PyCDC.GetSafeHdc
int = GetSafeHdc() Returns the HDC of this DC object.
- CDC::GetSafeHdc
PyCDC.GetTextExtent
(x,y) = GetTextExtent(text) Calculates the width and height of a line of text using the current font to determine the dimensions.
-
text : string
The text to calculate for.
- CFC::GetTextExtent
A tuple of integers with the size of the string, in logical units.
PyCDC.GetTextExtentPoint
(x,y) = GetTextExtentPoint(text) An alias for PyCDC::GetTextExtent.
GetTextExtentPoint is the preferred win32api name, but GetTextExtent is the MFC name.
Calculates the width and height of a line of text using the current font to determine the dimensions.
-
text : string
The text to calculate for.
A tuple of integers with the size of the string, in logical units.
PyCDC.GetTextFace
string = GetTextFace() Returns typeface name of the current font.
- CDC::GetTextFace
PyCDC.GetTextMetrics
dict = GetTextMetrics() Retrieves the metrics for the current font in this device context.
- CDC::GetTextMetrics
A dictionary of integers, keyed by the following strings:
tmHeight
tmAscent
tmDescent
tmInternalLeading
tmExternalLeading
tmAveCharWidth
tmMaxCharWidth
tmWeight
tmItalic
tmUnderlined
tmStruckOut
tmFirstChar
tmLastChar
tmDefaultChar
tmBreakChar
tmPitchAndFamily
tmCharSet
tmOverhang
tmDigitizedAspectX
tmDigitizedAspectY
PyCDC.GetViewportExt
x, y = GetViewportExt() Gets the viewport extent of the device context
PyCDC.GetViewportOrg
x, y = GetViewportOrg() Gets the viewport origin of the device context
PyCDC.GetWindowExt
x, y = GetWindowExt() Gets the window extent of the device context
PyCDC.GetWindowOrg
x, y = GetWindowOrg() Retrieves the x- and y-coordinates of the origin of the window associated with the device context.
PyCDC.IntersectClipRect
IntersectClipRect(rect) Creates a new clipping region by forming the intersection of the current region and the rectangle specified
-
rect : (left, top, right, bottom)
Specifies the bounding rectangle, in logical units.
- CDC::IntersectClipRect
region type as integer
PyCDC.IsPrinting
int = IsPrinting() Returns 1 if the DC is currently printing, else 0
PyCDC.LPtoDP
(x,y) = LPtoDP(point) Converts logical units into device units.
-
point : (x,y)
The point coordinate to convert.
-
x
The x coordinate to convert.
-
y
The y coordinate to convert.
- CDC::LPtoDP
The converted coordinates.
PyCDC.LineTo
LineTo(point) Draws a line to a specified point, using the currently selected pen.
-
point : (x,y)
The point coordinate to draw to.
-
x
The x coordinate to draw to.
-
y
The y coordinate to draw to.
- CDC::LineTo
PyCDC.MoveTo
(x,y) = MoveTo(point) Moves the current position to a specified point.
-
point : (x,y)
The point coordinate to move to.
-
x
The x coordinate to move to.
-
y
The y coordinate to move to.
- CDC::MoveTo
The previous position.
PyCDC.OffsetViewportOrg
x, y = OffsetViewportOrg(x,y) Modifies the coordinates of the viewport origin relative to the coordinates of the current viewport origin
-
x,y : int, int
The new origin offset.
The previous viewport origin as a tuple (x,y)
PyCDC.OffsetWindowOrg
x, y = OffsetWindowOrg(x,y) Modifies the coordinates of the window origin relative to the coordinates of the current window origin.
-
x,y : int, int
The new origin offset.
The previous origin as a tuple (x,y)
PyCDC.PatBlt
PatBlt(destPos, size, rop) Creates a bit pattern on the device.
-
destPos : (x,y)-ints
The logical x,y coordinates of the upper-left corner of the destination rectangle.
-
size : (width, height)-ints
Specifies the width and height (in logical units) of the destination rectangle and source bitmap.
-
rop : int
Specifies the raster operation to be performed. See the win32 api documentation for details.
- CDC::BitBlt
PyCDC.Pie
Pie(x1, y1, x2, y2, x3, y3, x4, y4) Draws a pie slice in a device context
-
x1 : int
X coordinate of upper left corner
-
y1 : int
Y coordinate of upper left corner
-
x2 : int
X coordinate of lower right corner
-
y2 : int
Y coordinate of lower right corner
-
x3 : int
X coordinate of starting point of arc
-
y3 : int
Y coordinate of starting point of arc
-
x4 : int
X coordinate of ending point of arc
-
y4 : int
Y coordinate of ending point of arc
PyCDC.PolyBezier
PolyBezier() Draws one or more Bezier splines.
PyCDC.Polygon
Polygon() Draws an Polygon.
PyCDC.Polyline
Polyline(points) Draws a Polyline.
-
points : [(x, y), ...]
A sequence of points
PyCDC.RealizePalette
int = RealizePalette() Maps palette entries in the current logical palette to the system palette.
Indicates how many entries in the logical palette were mapped to different entries
in the system palette. This represents the number of entries that this function
remapped to accommodate changes in the system palette since the logical palette
was last realized.
PyCDC.RectVisible
int = RectVisible(rect) Determines whether any part of the given rectangle lies within the clipping region of the display context.
-
rect : (left, top, right, bottom)
The coordinates of the reactangle to be checked.
- CDC::RectVisible
Non zero if any part of the rectangle lies within the clipping region, else zero.
PyCDC.Rectangle
rc = Rectangle() Draws a rectangle using the current pen. The interior of the rectangle is filled using the current brush.
PyCDC.RestoreDC
RestoreDC(saved) Restores the state of the device context.
-
saved : int
The id of a previously saved device context. See PyCDC::SaveDC
- CDC::RestoreDC
PyCDC.SaveDC
int = SaveDC() Saves the current state of the device context. Windows manages a stack of state information.
The saved device context can later be restored by using CDC::RestoreDC
- CDC::SaveDC
An integer identifying the context, which can be used by PyCDC::RestoreDC.
An exception is raised if this function fails.
PyCDC.ScaleViewportExt
x, y = ScaleViewportExt() Modifies the viewport extents relative to the current values.
PyCDC.ScaleWindowExt
x, y = ScaleWindowExt() Modifies the window extents relative to the current values.
PyCDC.SelectClipRgn
obRgn = SelectClipRgn() Selects the given region as the current clipping region for the device context
The return value specifies the region's complexity (integer)
PyCDC.SelectObject
object = SelectObject(ob) Selects an object into the device context.
Currently, only PyCFont, PyCBitMap, PyCBrush and PyCPen
objects are supported.
-
ob : object
The object to select.
- CDC::SelectObject
The previously selected object. This will be the same type as the object parameter.
PyCDC.SelectPalette
int = SelectPalette(hPalette, forceBackground
) Sets the logical palette.
-
hPalette : int
The handle to the palette
-
forceBackground : int
Specifies whether the logical palette is forced to be a background palette.
- CDC::SelectePalette
The previous palette handle.
PyCDC.SetBkColor
int = SetBkColor(color) Sets the current background color to the specified color.
-
color : int
A windows color specification. See the win32api documentation for details.
If the background mode is OPAQUE, the system uses the background color
to fill the gaps in styled lines, the gaps between hatched lines in brushes, and
the background in character cells.
The system also uses the background color when converting bitmaps between color and
monochrome device contexts.
- CDC::SetBkColor
The return value is the previous background color.
PyCDC.SetBkMode
int = SetBkMode(mode) Sets the current background mode to the specified mode.
-
mode : int
A background mode. May be either TRANSPARENT or OPAQUE.
Specifies the mode to be set. This parameter can be either OPAQUE or TRANSPARENT
- CDC::SetBkMode
The return value is the previous background mode.
PyCDC.SetBrushOrg
(int, int) = SetBrushOrg(point) Specifies the origin that GDI will assign to the next brush that the application selects into the device context.
-
point : (x,y)
The new origin in device units.
- CDC::SetBrushOrg
The previous origin in device units.
PyCDC.SetGraphicsMode
int = SetGraphicsMode(mode) Sets the graphics mode for the specified device context
-
mode : int
The new mode.
PyCDC.SetMapMode
int = SetMapMode(newMode) Sets the mapping mode for the device context.
-
newMode : int
The new mode. Can be one of
MM_ANISOTROPIC, MM_HIENGLISH, MM_HIMETRIC, MM_ISOTROPIC, MM_LOENGLISH, MM_LOMETRIC, MM_TEXT, MM_TWIPS
- CDC::SetMapMode
The previous mapping mode.
PyCDC.SetPixel
SetPixel(x, y, color) Sets a pixel in a device context
-
x : int
Horizontal coordinate.
-
y : int
Vertical coordinate.
-
color : int
The brush color.
PyCDC.SetPolyFillMode
(int) = SetPolyFillMode(point) Sets the polygon-filling mode.
-
point : (x,y)
The new origin in device units.
- CDC::SetPolyFillMode
The previous PolyFillMode as integer
The previous PolyFillMode.
PyCDC.SetROP2
dict = SetROP2(mode) Sets the current drawing mode.
-
mode : int
The new drawing mode.
- CDC::SetROP2
PyCDC.SetTextAlign
int = SetTextAlign(newFlags) Sets the text-alignment flags.
-
newFlags : int
The new alignment flags. Can be a combination of (TA_CENTER, TA_LEFT, TA_RIGHT), (TA_BASELINE, TA_BOTTOM, TA_TOP) and (TA_NOUPDATECP, TA_UPDATECP)
The default is TA_LEFT|TA_TOP|TA_NOUPDATECP
- CDC::SetTextAlign
The old alignment flags.
PyCDC.SetTextColor
int = SetTextColor(color) Sets the text color to the specified color.
-
color : int
A windows color specification. See the win32api documentation for details.
This text color is used when writing text to this device context and also when converting bitmaps between color and monochrome device contexts.
If the device cannot represent the specified color, the system sets the text color to the nearest physical color.
The background color for a character is specified by the SetBkColor and SetBkMode member functions.
- CDC::SetTextColor
The return value is the previous text color.
PyCDC.SetViewportExt
(x,y) = SetViewportExt(size) Sets the x,y extents of the viewport of the device context.
-
size : (x,y)
The new size.
- CDC::SetViewportExt
The previous extents of the viewport (in logical units).
PyCDC.SetViewportOrg
x, y = SetViewportOrg(x,y) Sets the viewport origin of the device context
-
x,y : int, int
The new origin.
PyCDC.SetWindowExt
(x,y) = SetWindowExt(size) Sets the x,y extents of the window associated with the device context.
-
size : (x,y)
The new size.
- CDC::SetWindowExt
The previous extents of the window (in logical units).
PyCDC.SetWindowOrg
x, y = SetWindowOrg(x,y) Sets the window origin of the device context
-
x,y : int, int
The new origin.
PyCDC.SetWorldTransform
int = SetWorldTransform() sets a two-dimensional linear transformation between world space and page space for the specified device context. This transformation can be used to scale, rotate, shear, or translate graphics output.
PyCDC.StartDoc
StartDoc(docName, outputFile) Starts spooling a document to a printer DC
-
docName : string
The document name
-
outputFile : string
The output file name. Use this to spool to a file. Omit to send to the printer.
PyCDC.StartPage
StartPage() Starts a new page on a printer DC
PyCDC.StretchBlt
StretchBlt(destPos, size, dc, srcPos, size, rop) Copies a bitmap from the source device context to this device context.
-
destPos : (x,y)-ints
The logical x,y coordinates of the upper-left corner of the destination rectangle.
-
size : (width, height)-ints
Specifies the width and height (in logical units) of the destination rectangle and source bitmap.
-
dc : PyCDC
Specifies the PyCDC object from which the bitmap will be copied. It must be None if rop specifies a raster operation that does not include a source.
-
srcPos : (xSrc, ySrc)-ints
Specifies the logical x,y coordinates of the upper-left corner of the source bitmap.
-
size : (widthsrc, heightsrc)-ints
Specifies the width and height (in logical units) of the destination rectangle and source bitmap.
-
rop : int
Specifies the raster operation to be performed. See the win32 api documentation for details.
- CDC::StretchBlt
PyCDC.StrokeAndFillPath
StrokeAndFillPath() Closes any open figures in a path, strokes the outline of the path by using the current pen, and fills its interior by using the current brush. The device context must contain a closed path.
PyCDC.StrokePath
StrokePath() Renders the specified path by using the current pen.
PyCDC.TextOut
TextOut(int, int, string) Outputs text to the display context, using the currently selected font.
-
int : x
The x coordinate to write the text to.
-
int : y
The y coordinate to write the text to.
-
string : text
The text to write.
- CDC::TextOut
Always none. If the function fails, an exception is raised.