Pen Constructor (Brush^)
.NET Framework (current version)
Namespace:
System.Drawing
Assembly: System.Drawing (in System.Drawing.dll)
Return to top
Assembly: System.Drawing (in System.Drawing.dll)
| Exception | Condition |
|---|---|
| ArgumentNullException | brush is null. |
The following code example demonstrates constructing a Pen with a Brush and the effects of setting the LineJoin property on a Pen.
This example is designed to be used with Windows Forms. Paste the code into a form and call the ShowLineJoin method when handling the form's Paint event, passing e as PaintEventArgs.
private: void ShowLineJoin( PaintEventArgs^ e ) { // Create a new pen. Pen^ skyBluePen = gcnew Pen( Brushes::DeepSkyBlue ); // Set the pen's width. skyBluePen->Width = 8.0F; // Set the LineJoin property. skyBluePen->LineJoin = System::Drawing::Drawing2D::LineJoin::Bevel; // Draw a rectangle. e->Graphics->DrawRectangle( skyBluePen, Rectangle(40,40,150,200) ); //Dispose of the pen. delete skyBluePen; }
.NET Framework
Available since 1.1
Available since 1.1
Show: