--- title: "Using a Pen to Draw Lines and Shapes" ms.date: "03/30/2017" helpviewer_keywords: - "pens" - "examples [Windows Forms], drawing lines and shapes" - "examples [Windows Forms], pens" - "drawing" ms.assetid: 8a7542ab-3e9e-443f-8405-2d6053528e20 --- # Using a Pen to Draw Lines and Shapes Use GDI+ `Pen` objects to draw line segments, curves, and the outlines of shapes. In this section, *line* refers to any of these, unless specified to mean only a line segment. Set the properties of a pen to control the color, width, alignment, and style of lines drawn with that pen. ## In This Section [How to: Use a Pen to Draw Lines](how-to-use-a-pen-to-draw-lines.md) Explains how to draw lines. [How to: Use a Pen to Draw Rectangles](how-to-use-a-pen-to-draw-rectangles.md) Describes how to draw rectangles. [How to: Set Pen Width and Alignment](how-to-set-pen-width-and-alignment.md) Explains how to change the width and alignment of a `Pen` object. [How to: Draw a Line with Line Caps](how-to-draw-a-line-with-line-caps.md) Describes how to add end caps when drawing a line. [How to: Join Lines](how-to-join-lines.md) Shows how to join two lines. [How to: Draw a Custom Dashed Line](how-to-draw-a-custom-dashed-line.md) Describes how to draw a dashed line. [How to: Draw a Line Filled with a Texture](how-to-draw-a-line-filled-with-a-texture.md) Explains how to draw a texture-filled line. ## Reference Describes this class and has links to all its members.