GraphicsPath::Widen Method (Pen^, Matrix^, Single)
Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- pen
-
Type:
System.Drawing::Pen^
A Pen that specifies the width between the original outline of the path and the new outline this method creates.
- matrix
-
Type:
System.Drawing.Drawing2D::Matrix^
A Matrix that specifies a transform to apply to the path before widening.
- flatness
-
Type:
System::Single
A value that specifies the flatness for curves.
This method creates an outline around the original lines in this GraphicsPath, with a distance between the existing lines and the new outline equal to that of the width of the Pen used in the call to Widen. If you want to fill the space between the lines you must use the FillPath rather then the DrawPath.
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 and adds two ellipses to the path.
Draws the path in black.
Widens the path.
Draws the path in red.
Notice that the second rendering uses FillPath instead of DrawPath, and hence the rendered figure has the outline filled.
private: void WidenExample( PaintEventArgs^ e ) { // Create a path and add two ellipses. GraphicsPath^ myPath = gcnew GraphicsPath; myPath->AddEllipse( 0, 0, 100, 100 ); myPath->AddEllipse( 100, 0, 100, 100 ); // Draw the original ellipses to the screen in black. e->Graphics->DrawPath( Pens::Black, myPath ); // Widen the path. Pen^ widenPen = gcnew Pen( Color::Black,10.0f ); Matrix^ widenMatrix = gcnew Matrix; widenMatrix->Translate( 50, 50 ); myPath->Widen( widenPen, widenMatrix, 1.0f ); // Draw the widened path to the screen in red. e->Graphics->FillPath( gcnew SolidBrush( Color::Red ), myPath ); }
Available since 1.1