An arc is a line segment of an ellipse. The routines in this class allow you to draw the arc by calling the Windows API Arc function.
|(Declarations)||Declarations||Declarations and private variables for the CGDIArc class.|
|BorderColor||Property||Get the current value of the color used to draw the arc.|
|BorderWidth||Property||Get the current value of the BorderWidth used to draw the arc.|
|Bottom||Property||Get the Bottom location of the bounding rectangle for the arc.|
|ForegroundMixMode||Property||Get the current value of 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 EnumArcRasterOps, or the equivalent VBA/VB6 "DrawModeConstants", such as vbCopyPen, vbXorPen etc. See "Drawing Constants" in the VBA/VB6 on-line help.|
|Left||Property||Get the Left location of the bounding rectangle for the arc.|
|PenStyle||Property||Get the value of the style used to draw the arc. 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 EnumArcPenStyles constants in this class.|
|Right||Property||Get the Right location of the bounding rectangle for the arc.|
|Top||Property||Get the Top location of the bounding rectangle for the arc.|
|Class_Initialize||Initialize||Set initial values to defaults which may be overridden with property settings.|
|DrawArc||Method||Draw an arc on a selected device. The arc is drawn along the edge of an ellipse bounded by an imaginary rectangle, whose dimensions are specified in the Left, Top, Right, and Bottom properties. The end points of the arc are determined by the arguments to this method.|
|DrawArcByAngle||Method||Draw an arc on a selected device with start and end angles. The arc is drawn along the outside of an imaginary ellipse bounded by the dimensions of a rectangle specified in the Left, Top, Bottom and Right properties.|
|DrawArcByAngleSweep||Method||Draw an arc on a selected device from a starting point for a specified number of degrees. The arc is drawn along the outside of an imaginary ellipse bounded by the dimensions of a rectangle specified in the Left, Top, Bottom and Right properties.|
|TranslateVBColor||Private||Translates VBA/VB6 color constants for system colors into GDI equivalents. VBA/VB6 color constants, such as vbRed, 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 VBA/VB6 color constants for system colors (vbButtonFace, vb3DShadow etc.) do not map correctly to those expected by Windows. This function accepts either form of constant and translates the value, if necessary, into the equivalent value expected by the Windows GDI subsystem.|
' Example of the CGDIArc class ' ' To try this example, do the following: ' 1. Create a new form ' 2. Paste all the code from this example to the new form's module ' 3. Run the form and click on the background. The arcs are drawn ' based on the location of the click Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single) Dim GDIArc As CGDIArc Set GDIArc = New CGDIArc With GDIArc .Left = ScaleX(X, vbTwips, vbPixels) - 100 .Top = ScaleY(Y, vbTwips, vbPixels) - 100 .Right = ScaleX(X, vbTwips, vbPixels) + 100 .Bottom = ScaleY(Y, vbTwips, vbPixels) + 100 .BorderWidth = 2 ' these are the default values .ForegroundMixMode = aroR2_COPYPEN .PenStyle = apsPS_SOLID ' Draw an arc by specifying the radial end-points .BorderColor = vbBlue .DrawArc Me.hDC, .Right, .Bottom + 10, .Right - 10, .Top ' Draw an arc by specifying the angles .BorderColor = vbGreen .DrawArcByAngle Me.hDC, 90, 180 ' Draw an arc by specifying the starting angle and an offset .BorderColor = vbRed .DrawArcByAngleSweep Me.hDC, 200, 10 End With End Sub
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.
Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!
Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!
"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