"The code is exactly
how I would like to write code and the algorithms used are very
efficient and well-documented."
Van T. Dinh, Microsoft MVP
|
|
Class: CGDIPolygon
Class that draws a polygon, using Windows API GDI calls. This class lets you draw an arbitrary polygon made up of a collection of straight-line segments, whose end-points are specified by the X and Y position in pixels. Specify the number of points in the polygon by setting the PointCount property. Then set the points between 1 and PointCount to valid X and Y point positions. The routines in this class allow you to draw the shape by calling the Windows API DrawPolygon function.
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the CGDIPolygon class
|
|
BorderColor
|
Property
|
Sets the value of the color used to draw the polygon
|
|
BorderWidth
|
Property
|
Gets the current value of the BorderWidth used to draw the polygon
|
|
BrushStyle
|
Property
|
Sets the current style used to fill the polygon.
The value of this property should be set to one of the Windows API Brush Style constants (BS_SOLID, BS_HOLLOW, BS_HATCHED etc.) which are exposed as EnumPolygonBrushStyles constants in this class.
|
|
FillColor
|
Property
|
Sets the value of the color used to fill the polygon
|
|
FillMode
|
Property
|
Gets the current mode used to fill complex polygons with overlapping sections.
The value of this property should be set to one of the Windows API Fill Mode constants (ALTERNATE or WINDING.) which are exposed as EnumPolygonFillModes constants in this class. This property controls how the polygon is filled if it contains overlapping segments (for example, if the polygon creates the shape of a star, pfmALTERNATE will fill in the "points"; pfmWINDING will fill in the entire star.)
|
|
ForegroundMixMode
|
Property
|
Sets the ForegroundMixMode property, which defines how colors from the pen and the colors in the existing image are to be combined.
The value should be one of the enumerated raster op values exposed in EnumPolygonRasterOps, or the equivalent VB "DrawModeConstants", such as vbCopyPen, vbXorPen etc. See "Drawing Constants" in the VB on-line help.
|
|
HatchStyle
|
Property
|
Sets the current value of the style used to fill the polygon when the BrushStyle is set to hatched.
The value of this property should be set to one of the Windows API Hatch Style constants (HS_HORIZONTAL, HS_BDIAGONAL, HS_CROSS etc.) which are exposed as EnumPolgyonHatchStyles constants in this class.
|
|
PenStyle
|
Property
|
Gets the value of the style used to draw the polygon.
The value of this property should be set to one of the Windows API Pen Style constants (PS_SOLID, PS_DASHDOT etc.) which are exposed as EnumPolygonPenStyles constants in this class.
|
|
PointCount
|
Property
|
Sets the number of points in the polygon.
|
|
Class_Initialize
|
Initialize
|
Set initial values to defaults which may be overridden with property settings
|
|
DrawPolyGon
|
Method
|
Draw a PolyGon on a selected device.
Specify the points making up the polygon by using the SetPoint method. When all of the points have been specified, use this method to actually draw the polygon on the selected device.
|
|
GetPoint
|
Method
|
Modifies the passed lngX and lngY parameters with the X and Y values of the specified point.
If you wish to determine the X and Y values of a point which was previously added to the collection with the SetPoint method, call this method. The X and Y coordinate values are placed into the passed 'lngX' and 'lngY' parameters to the function.
|
|
SetPoint
|
Method
|
Sets the X and Y coordinates of one of the points in the polygon
|
|
TranslateVBColor
|
Private
|
Translates VB color constants for system colors into GDI equivalents.
VB color constants, such as vbRed, or vbBlue, or values returned using the QBColor() or RGB() functions, can be used directly for the color values used with Windows API calls. However, the VB color constants for system colors (vbButtonFace, vb3DShadow etc.) do not map correctly to those expected by Windows. This wrapper function accepts either form of constant, and translates the value, if necessary, into the equivalent value expected by the Windows GDI subsystem.
|
Overview of Total Visual SourceBook
The source code in Total Visual
SourceBook includes modules and classes for Microsoft Access, Visual
Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily
add this professionally written, tested, and documented royalty-free code
into your applications to simplify your application development efforts.
Additional Resources
|
|