AngleArc Function

Declare Function AngleArc Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal dwRadius As Long, ByVal eStartAngle As Single, ByVal eSweepAngle As Single) As Long

Platforms

Description & Usage

AngleArc draws a circular arc on a device using the device's current pen. The circle which the arc lies on is determined by its center and radius. The start and end points of the arc are determined by angle measures in degrees, measured counterclockwise from the line parallel to the positive x-axis (i.e., from due right). The arc itself is drawn either clockwise or counterclockwise to connect the points, depending on the device's settings. AngleArc also draws a line connecting the device's current point to the beginning of the arc.

Return Value

If an error occurs, the function returns 0 (call GetLastError to get the error code). If the function succeeds, the function returns a non-zero value.

Visual Basic-Specific Issues

None

Parameters

hdc
A handle to a device context of the device to draw the arc on.
x
The x coordinate of the center of the circle.
y
The y coordinate of the center of the circle.
dwRadius
The radius of the circle.
eStartAngle
The angle (in degrees) identifying the starting point of the arc.
eSweepAngle
The angle (in degrees) identifying the ending point of the arc.

Example

' This code is licensed according to the terms and conditions listed here.

' Draw an arc formed by the upper half of a circle (from 0 to 180
' degrees counterclockwise).  The circle is centered at (100, 150) and has a radius
' of 50.  The arc is drawn using the solid black stock pen.
Dim hpen As Long  ' handle to the black stock pen
Dim holdpen As Long  ' handle to Form1's previously selected pen
Dim retval As Long  ' return value

' Get the solid black stock pen and select it for use in Form1.
hpen = GetStockObject(BLACK_PEN)  ' get the pen's handle
holdpen = SelectObject(Form1.hDC, hpen)  ' select the pen

' Make sure arcs are drawn going counterclockwise
retval = SetArcDirection(Form1.hDC, AD_COUNTERCLOCKWISE)
' Draw the arc
retval = AngleArc(Form1.hDC, 100, 150, 50, 0, 180)

' Select Form1's previous pen to restore the "defaults".
retval = SelectObject(Form1.hDC, holdpen)  ' select the old pen

See Also

Arc, ArcTo, Ellipse, GetArcDirection, SetArcDirection

Category

Lines & Curves

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: July 27, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/a/anglearc.html