Windows API Guide: Error Codes


Declare Function PolyBezierTo Lib "gdi32.dll" (ByVal hdc As Long, lppt As POINT_TYPE, ByVal cCount As Long) As Long

Platforms

  • Windows 95: Supported.
  • Windows 98: Supported.
  • Windows NT: Requires Windows NT 3.1 or later.
  • Windows 2000: Supported.
  • Windows CE: Not Supported.

Description & Usage

PolyBezierTo draws a series of cubic Bézier curves on a device. Each Bézier curve is drawn using the device's current pen. The function begins drawing the curves at the device's current point and draws each subsequent curve starting at the point where the previous one ended (for example, if the second curve ended at (100,50), the third curve would begin at (100,50) as well).

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 Bézier curves on.
lppt
An array containing all the end points and control points for the Bézier curves. Each set of three points identifies one curve: the first two points are the control points, and the third point is the end point of the curve.
cPoints
The number of elements in the array passed as lppt. This value will have to be three times the number of curves to draw.

Example

' This code is licensed according to the terms and conditions listed here. ' Use the solid black stock pen to draw a straight line, ' followed by two Bézier curves on window Form1.  The ' coordinates of the line and curves appear in the example code. Dim hPen As Long  ' handle to the solid black stock pen Dim hOldPen As Long  ' handle to Form1's previous pen Dim curpt As POINT_TYPE  ' receives previous current point Dim pts(0 To 5) As POINT_TYPE  ' array of points for the curves Dim retval As Long  ' return value ' Get a handle to the solid black stock pen. hPen = GetStockObject(BLACK_PEN) ' Select the pen for use in Form1. hOldPen = SelectObject(Form1.hDC, hPen) ' Move the current point to (200, 25) and draw a line ' to the point (100,100). retval = MoveToEx(Form1.hDC, 200, 25, curpt) retval = LineTo(Form1.hDC, 100, 100) ' Load the six points defining the two Bézier curves ' into the array.  The first three points define the first curve. ' The curve will of course start of (100,100). pts(0).x = 125: pts(0).y = 75   ' control point (125,75) pts(1).x = 150: pts(1).y = 125  ' control point (150,125) pts(2).x = 175: pts(2).y = 100  ' 1st curve ends at (175,100) ' The next three define the second curve, starting at (175,100) pts(3).x = 225: pts(3).y = 50   ' control point (225,50) pts(4).x = 300: pts(4).y = 150  ' control point (300, 150) pts(5).x = 250: pts(5).y = 200  ' 2nd curve ends at (250,200) ' Draw the two Bézier curves. retval = PolyBezierTo(Form1.hDC, pts(0), 6) ' Select the previous pen used by Form1. retval = SelectObject(Form1.hDC, hOldPen)

See Also

PolyBezier

Category

Lines & Curves

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


Last Modified: November 11, 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/p/polybezierto.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net