logo search
CSharp_Graphics

Компиляция кода

Предыдущий пример предназначен для работы с Windows Forms, для него необходим объект PaintEventArgs e, передаваемый в качестве параметра обработчику события Paint.

How to: Draw a Sequence of Bézier Splines

You can use the DrawBeziers method of the Graphics class to draw a sequence of connected Bézier splines.

Example

The following example draws a curve that consists of two connected Bézier splines. The endpoint of the first Bézier spline is the start point of the second Bézier spline.

The following illustration shows the connected splines along with the seven points.

Point[] p = {

new Point(10, 100), // start point of first spline

new Point(75, 10), // first control point of first spline

new Point(80, 50), // second control point of first spline

new Point(100, 150), // endpoint of first spline and

// start point of second spline

new Point(125, 80), // first control point of second spline

new Point(175, 200), // second control point of second spline

new Point(200, 80)}; // endpoint of second spline

Pen pen = new Pen(Color.Blue);

e.Graphics.DrawBeziers(pen, p);

Compiling the Code

The preceding example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler.