Monthly Archives: March 2015

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

Use steganography to hide messages in an image in C#

Steganography is the science of hiding information within other information. For example, a watermark “hides” an image on a piece of paper. If you look at most paper currency at a low angle or if you hold it up to … Continue reading

Posted in algorithms, cryptography, graphics, image processing, mathematics | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Graph several pi approximations in C#

This example graphs pi approximations by combining the techniques described in the following two posts: Approximate pi using several different methods in C# Graph pi approximations in C# For each series, the program uses the series to generate approximations for … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Approximate pi using several different methods in C#

The post In honor of Pi Day (3.14), approximate pi in C# uses the following sequence to approximate pi. That sequence is elegant but unfortunately it converges very slowly so you need to take a lot of terms to get … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , , , , , , , , | 1 Comment

Graph pi approximations in C#

My post In honor of Pi Day (3.14), approximate pi in C# uses the following series to approximate the value π. As you add terms to the series, the approximation alternates between values that are above and below the true … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , | 1 Comment