GDI+ Tutorials: A Series of Bézier Curves |
|
Introduction |
The Graphics::DrawBezier() method is used to draw one bézier curve. If you want to draw many bézier curves, you can call the Graphics::DrawBeziers() method that is overloaded in two versions as follows: public: void DrawBeziers(Pen^ pen, array<Point> ^ points); void DrawBeziers(Pen^ pen, array<PointF> ^ points); |
The DrawBeziers() method requires an array of Point of PointF values. When working with only four coordinates, the DrawBeziers() method works exactly like DrawBezier(), the different is that, while DrawBezier() expects four Point or four PointF values, DrawBeziers() expects an array of Point or PointF values. Using, DrawBeziers(), the above bézier curve can be drawn as follows and produce the same result: System::Void Form1_Paint(System::Object ^ sender, System::Windows::Forms::PaintEventArgs ^ e) { Pen ^ penCurrent = gcnew Pen(Color::Blue); array<Point> ^ pt = { Point(20, 12), Point(88, 246), Point(364, 192), Point(250, 48) }; e->Graphics->DrawBeziers(penCurrent, pt); } This would produce: A characteristic of using DrawBeziers() is that it allows you to draw a bézier curve using 7 Point or PointF values. Here is an example: System::Void Form1_Paint(System::Object ^ sender, System::Windows::Forms::PaintEventArgs ^ e) { Pen ^ penCurrent = gcnew Pen(Color::Blue); array<Point> ^ pt = { Point( 10, 5), Point(340, 60), Point(320, 148), Point(150, 120), Point(24, 220), Point(250, 150), Point(304, 240) }; e->Graphics->DrawBeziers(penCurrent, pt); } This would produce: |
|
||
Home | Copyright © 2007-2013, FunctionX | |
|