Declare Function ArcTo Lib "gdi32.dll" (ByVal hdc As Long, ByVal nLeftRect As Long, ByVal nTopRect As Long, ByVal nRightRect As Long, ByVal nBottomRect As Long, ByVal nXRadial1 As Long, ByVal nYRadial1 As Long, ByVal nXRadial2 As Long, ByVal nYRadial2 As Long) As Long
ArcTo draws an elliptical arc on a device using the device's current pen. After drawing the arc, the device's current point is set to the end point of the arc. The ellipse which the arc lies on is inscribed within the bounding rectangle coordinates passed to the function. The start and end points are determined by two radials. The radials begin at the center of the ellipse and extend through the given radial point (either the start or end one); where they intersect the ellipse is where the start and end points of the arc are. The direction the arc is drawn in depends on the device's current setting.
If an error occured while attempting to draw the arc, the function returns 0 (call GetLastError to get the error code). If the function completed successfully, it returns a non-zero value.
None.
' This code is licensed according to the terms and conditions listed here.
' Draw the arc that forms the top half of an ellipse. The ellipse
' is centered at (100, 100), has a width of 200, and has a height of 100. The arc is drawn
' on window Form1 using the black solid stock pen.
Dim hpen As Long ' handle to the black solid pen
Dim holdpen As Long ' handle to window Form1's previously selected pen
Dim retval As Long ' return value
' Get a handle to the solid black pen and set it as Form1's drawing pen.
hpen = GetStockObject(BLACK_PEN) ' get a handle to the pen
holdpen = SelectObject(Form1.hDC, hpen) ' set it as Form1's current pen
' The ellipse is determined by the bounding rectangle (0,50)-(200,150).
' The radial to (200, 100) is due right; the radial to (0, 100) is due left.
retval = ArcTo(Form1.hDC, 0, 50, 200, 150, 200, 100, 0, 100)
' Restore Form1's previous pen selection.
retval = SelectObject(Form1.hDC, holdpen) ' set the old pen back
AngleArc, Arc, Ellipse, GetArcDirection, SetArcDirection
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/arcto.html