GraphicsPath::AddBezier Method (Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)
Adds a cubic Bézier curve to the current figure.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- x1
-
Type:
System::Int32
The x-coordinate of the starting point of the curve.
- y1
-
Type:
System::Int32
The y-coordinate of the starting point of the curve.
- x2
-
Type:
System::Int32
The x-coordinate of the first control point for the curve.
- y2
-
Type:
System::Int32
The y-coordinate of the first control point for the curve.
- x3
-
Type:
System::Int32
The x-coordinate of the second control point for the curve.
- y3
-
Type:
System::Int32
The y-coordinate of the second control point for the curve.
- x4
-
Type:
System::Int32
The x-coordinate of the endpoint of the curve.
- y4
-
Type:
System::Int32
The y-coordinate of the endpoint of the curve.
The cubic curve is constructed from the first point to the fourth point by using the second and third points as control points.
If there is a previous line or curve segment in the figure, a line is added to connect the endpoint of the previous segment to the starting point of the cubic curve.
The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. The code performs the following actions:
Creates a path.
Adds a cubic Bézier curve defined by the points (50, 50), (70, 0), (100, 120), and (150, 50) to the path.
Closes the curve.
Draws the path to screen.
private: void AddBezierExample( PaintEventArgs^ e ) { // Create a new Path. GraphicsPath^ myPath = gcnew GraphicsPath; // Call AddBezier. myPath->StartFigure(); myPath->AddBezier( 50, 50, 70, 0, 100, 120, 150, 50 ); // Close the curve. myPath->CloseFigure(); // Draw the path to screen. e->Graphics->DrawPath( gcnew Pen( Color::Red,2.0f ), myPath ); }
Available since 1.1