Chord Function

Declare Function Chord 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

Platforms

Description & Usage

Chord draws an elliptical chord on a device. The chord is drawn using the device's currently selected pen and is filled using its currently selected brush. The chord consists of a line segment connecting two points along an ellipse; the area between the chord and the ellipse's edge is filled (going counterclockwise around the ellipse). The start and end points of the chord's elliptical arc are determined by two radials (drawn from the ellipse's center out to a point). The point where a radial and the ellipse intersect is the start or end point of the chord's arc.

Return Value

If an error occured, the function returns 0 (Windows NT, 2000: use GetLastError to get the error code). If successful, the function returns a non-zero value.

Visual Basic-Specific Issues

None.

Parameters

hdc
A handle to a device context to the device to draw the chord on.
nLeftRect
The x-coordinate of the upper-left corner of the ellipse's bounding rectangle.
nTopRect
The y-coordinate of the upper-left corner of the ellipse's bounding rectangle.
nRightRect
The x-coordinate of the lower-right corner of the ellipse's bounding rectangle.
nBottomRect
The y-coordinate of the lower-right corner of the ellipse's bounding rectangle.
nXRadial1
The x-coordinate of the point along the radial determining the starting point of the chord.
nYRadial1
The y-coordinate of the point along the radial determining the starting point of the chord.
nXRadial2
The x-coordinate of the point along the radial determining the ending point of the chord.
nYRadial2
The y-coordinate of the point along the radial determining the ending point of the chord.

Example

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

' Draw a chord on window Form1.  The ellipse has a bounding rectangle
' of (10,20)-(210,120).  The chord will have endpoints on the ellipse of (210,70)
' and (110,20) -- i.e., the "upper-right" portion of the ellipse.  Draw the chord using
' Form1's current brush and pen.
Dim retval As Long  ' return value

' Draw the chord as specified above.
retval = Chord(Form1.hDC, 10, 20, 210, 120, 210, 70, 110, 20)

See Also

Ellipse, Pie

Category

Filled Shapes

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


Last Modified: September 10, 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/c/chord.html