Tag Archives: draw curves

Let the user zoom on a picture and draw in C#

The example Let the user zoom on a picture in C# allows the user to zoom in on a picture and draw on it. Unfortunately, it doesn’t handle the drawing properly when the image is scaled. It doesn’t scale the … Continue reading

Posted in drawing, files, graphics, serialization, transformations | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Draw a curve with more sharply delineated colors in C#

In the post Draw a curve with sharply delineated colors in C# I mentioned that you could achieve even more sharply defined colors if you use a TextureBrush. Naturally I couldn’t let it reset so here’s an example that does … Continue reading

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

Draw a curve with sharply delineated colors in C#

The post Draw a curve with multiple colors in C# shows how you can draw a curve that shades gradually from one color to another as the curve’s Y coordinates change. However, you might not always want the colors to … Continue reading

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

Draw a curve with multiple colors in C#

It’s easy enough to draw different lines with different colors but it’s not as easy to draw a single line that uses multiple colors. One way to accomplish that is to make a LinearGradientBrush that defines the colors that you … Continue reading

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

Let the user zoom on a picture in C#

Important: This example does not handle new drawings correctly if you have scaled the image. Read this one to learn how it works and then see the new post Let the user zoom on a picture and draw in C#. … Continue reading

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

Provide autosave in C#

This example extends the scribble example (most recently described in the post Provide undo and redo in C#) so it provides an auto-save feature. The following code creates the name of the program’s auto-save file. // The auto-save file name. … Continue reading

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

Provide undo and redo in C#

This example adds undo and redo features to the example Save and restore pictures drawn by the user in C#. It’s not terribly hard, but it is long so I’ll break it into sections to make it easier to understand. … Continue reading

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

Save and restore pictures drawn by the user in C#

The example Let the user scribble with different line styles in C# explains how to let the user draw curves with different colors, line thicknesses, and dash patterns. This example adds the ability to save and load pictures drawn by … Continue reading

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

Let the user scribble with different line styles in C#

The example Let the user scribble on a PictureBox in C# explains how to let the user draw polylines, but the program only draws thin black curves. This example adds color, line thickness, and line styles such as dashed or … Continue reading

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

Let the user scribble on a PictureBox in C#

The Graphics class provides a DrawLines method that draws a series of connected lines, which is sometimes called a polyline. This program lets the user create a series of polylines. The program stores the points that make up a polyline … Continue reading

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