GraphicsPath.AddBezier Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a cubic Bézier curve to the current figure.
Overloads
AddBezier(Point, Point, Point, Point) |
Adds a cubic Bézier curve to the current figure. |
AddBezier(PointF, PointF, PointF, PointF) |
Adds a cubic Bézier curve to the current figure. |
AddBezier(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) |
Adds a cubic Bézier curve to the current figure. |
AddBezier(Single, Single, Single, Single, Single, Single, Single, Single) |
Adds a cubic Bézier curve to the current figure. |
AddBezier(Point, Point, Point, Point)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Adds a cubic Bézier curve to the current figure.
public:
void AddBezier(System::Drawing::Point pt1, System::Drawing::Point pt2, System::Drawing::Point pt3, System::Drawing::Point pt4);
public void AddBezier (System.Drawing.Point pt1, System.Drawing.Point pt2, System.Drawing.Point pt3, System.Drawing.Point pt4);
member this.AddBezier : System.Drawing.Point * System.Drawing.Point * System.Drawing.Point * System.Drawing.Point -> unit
Public Sub AddBezier (pt1 As Point, pt2 As Point, pt3 As Point, pt4 As Point)
Parameters
Examples
For an example, see AddBezier(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32).
Remarks
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.
Applies to
AddBezier(PointF, PointF, PointF, PointF)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Adds a cubic Bézier curve to the current figure.
public:
void AddBezier(System::Drawing::PointF pt1, System::Drawing::PointF pt2, System::Drawing::PointF pt3, System::Drawing::PointF pt4);
public void AddBezier (System.Drawing.PointF pt1, System.Drawing.PointF pt2, System.Drawing.PointF pt3, System.Drawing.PointF pt4);
member this.AddBezier : System.Drawing.PointF * System.Drawing.PointF * System.Drawing.PointF * System.Drawing.PointF -> unit
Public Sub AddBezier (pt1 As PointF, pt2 As PointF, pt3 As PointF, pt4 As PointF)
Parameters
Examples
For an example, see AddBezier(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32).
Remarks
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.
Applies to
AddBezier(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Adds a cubic Bézier curve to the current figure.
public:
void AddBezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
public void AddBezier (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
member this.AddBezier : int * int * int * int * int * int * int * int -> unit
Public Sub AddBezier (x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer, x3 As Integer, y3 As Integer, x4 As Integer, y4 As Integer)
Parameters
- x1
- Int32
The x-coordinate of the starting point of the curve.
- y1
- Int32
The y-coordinate of the starting point of the curve.
- x2
- Int32
The x-coordinate of the first control point for the curve.
- y2
- Int32
The y-coordinate of the first control point for the curve.
- x3
- Int32
The x-coordinate of the second control point for the curve.
- y3
- Int32
The y-coordinate of the second control point for the curve.
- x4
- Int32
The x-coordinate of the endpoint of the curve.
- y4
- Int32
The y-coordinate of the endpoint of the curve.
Examples
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, 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 );
}
private void AddBezierExample(PaintEventArgs e)
{
// Create a new Path.
GraphicsPath myPath = new 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(new Pen(Color.Red, 2), myPath);
}
Public Sub AddBezierExample(ByVal e As PaintEventArgs)
' Create a new Path.
Dim myPath As New 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(New Pen(Color.Red, 2), myPath)
End Sub
Remarks
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.
Applies to
AddBezier(Single, Single, Single, Single, Single, Single, Single, Single)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Adds a cubic Bézier curve to the current figure.
public:
void AddBezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
public void AddBezier (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
member this.AddBezier : single * single * single * single * single * single * single * single -> unit
Public Sub AddBezier (x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single, x4 As Single, y4 As Single)
Parameters
- x1
- Single
The x-coordinate of the starting point of the curve.
- y1
- Single
The y-coordinate of the starting point of the curve.
- x2
- Single
The x-coordinate of the first control point for the curve.
- y2
- Single
The y-coordinate of the first control point for the curve.
- x3
- Single
The x-coordinate of the second control point for the curve.
- y3
- Single
The y-coordinate of the second control point for the curve.
- x4
- Single
The x-coordinate of the endpoint of the curve.
- y4
- Single
The y-coordinate of the endpoint of the curve.
Examples
For an example, see AddBezier(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32).
Remarks
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.