Tag Archives: dashed lines

Draw “marching ants” dashed lines in C#

The example Draw dashed lines that are visible on any background in C# shows how to draw lines that are visible above any backgrounds. If the background is very cluttered, however, it may still be somewhat hard to see the … Continue reading

Posted in animation, drawing, graphics | Tagged , , , , , , , , , , , , , | 4 Comments

Draw dashed lines that are visible on any background in C#

This example shows how to draw dashed lines that are visible on any background. Sometimes it’s hard to draw lines that are visible on top of a photo or other complicated background. For example, when the user is clicking and … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , | 1 Comment

Render dashed lines in a WPF program using C#

When you draw in WPF, you create a Pen object. You can set that object’s DashStyle to make the pen draw dashed or dotted lines. The following code shows how this example draws the second line from the top. Pen … Continue reading

Posted in drawing, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Draw lines with custom dash patterns in C#

To create lines with custom dash patterns, first create a Pen object and set its DashStyle property to Custom. Then set its DashPattern property to an array of floating point numbers that indicate how many units to draw and then … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , , | Leave a comment

Draw dashed lines with different dash cap styles in C#

A dash cap determines how the program draws the ends of the dots and dashes that make up a dashed line. If the line is 1 pixel wide, you probably won’t notice any difference, but dash caps are easy to … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , | 3 Comments

Draw dashed lines with different styles in C#

To draw dashed lines, create a new Pen and set its DashStyle property to indicate the dash style you want. For example, the following code draws two dashed lines, one with the style Dash and one with the style DashDot. … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , | Leave a comment