GraphicsPath::AddPath Method (GraphicsPath^, Boolean)
Appends the specified GraphicsPath to this path.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- addingPath
-
Type:
System.Drawing.Drawing2D::GraphicsPath^
The GraphicsPath to add.
- connect
-
Type:
System::Boolean
A Boolean value that specifies whether the first figure in the added path is part of the last figure in this path. A value of true specifies that (if possible) the first figure in the added path is part of the last figure in this path. A value of false specifies that the first figure in the added path is separate from the last figure in this path.
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 two paths one a right-side-up triangle and the other an up-side-down triangle.
Adds the second path to the first.
Draws the resultant path to the screen.
private: void AddPathExample( PaintEventArgs^ e ) { // Create the first pathright side up triangle. array<Point>^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)}; GraphicsPath^ myPath = gcnew GraphicsPath; myPath->AddLines( myArray ); // Create the second pathinverted triangle. array<Point>^ myArray2 = {Point(30,30),Point(0,0),Point(60,0),Point(30,30)}; GraphicsPath^ myPath2 = gcnew GraphicsPath; myPath2->AddLines( myArray2 ); // Add the second path to the first path. myPath->AddPath( myPath2, true ); // Draw the combined path to the screen. Pen^ myPen = gcnew Pen( Color::Black,2.0f ); e->Graphics->DrawPath( myPen, myPath ); }
Available since 1.1