GDI+ Pen Sample

To get samples and instructions for installing them, see the following:

  • Click Samples on the Visual Studio Help menu.

    For more information, see Locating Sample Files.

  • The most recent versions and the complete list of samples are available on the Visual Studio 2008 Samples Web site.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied to a folder under \Program Files\Visual Studio 9\Samples\. For Visual Studio Express Editions, all samples are located on the Internet.

To run this sample

  • Press F5.

Demonstrate

Several controls enable the user to select pen characteristics:

  • Width

  • DashStyle

  • MiterLimit

  • StartCap

  • EndCap

  • DashCap

  • LineJoin

  • Alignment

The user can also select among three transforms:

  • ScaleTransform

  • RotateTransform

  • TranslateTransform

Once the Pen and transforms are configured, the user can select the figure to draw:

  • Lines   Lines are drawn using the DrawLine method.

  • Intersecting lines   Lines are drawn using the DrawLines method.

  • Circles and curves   Lines are drawn using the DrawEllipse and DrawArc methods.