Monthly Archives: January 2016

Draw four interlocking Heighway dragons in C#

One of the interesting features of the Heighway dragon curve is that it can interlock with itself as shown in this picture. The four curves all start at the same point in the middle of the picture and each is … Continue reading

Posted in algorithms, drawing, fractals, graphics, mathematics | Tagged , , , , , , , , , , , , , , , | Leave a comment

Center a Heighway dragon fractal in C#

The example Draw a Heighway dragon fractal in C# explains how to draw a Heighway dragon. That example draws its curve somewhere near the center of the form but the curve isn’t really centered. To properly size and center the … Continue reading

Posted in algorithms, drawing, fractals, graphics, mathematics | Tagged , , , , , , , , , , , , , | Leave a comment

Draw a Heighway dragon fractal in C#

The Heighway dragon, which is also known as the Harter–Heighway dragon, is a recursive curve where each level of recursion provides more detail. The base case where the level of recursion is 0 is a straight line. From any given … Continue reading

Posted in algorithms, drawing, fractals, graphics, mathematics | Tagged , , , , , , , , , , , | 1 Comment

Control serialization and deserialization in C#

For information on basic serialization and deserialization, see Serialize and deserialize objects in C#. By placing attributes on a class’s properties, you can control how those properties are serialized. The following code shows a Person class that demonstrates several XML … Continue reading

Posted in algorithms, serialization | Tagged , , , , , , , | Leave a comment

Serialize and deserialize objects in C#

Serialization is the process of converting an object into a serial stream-like format. Often that means converting it into XML data for storage or transmission over a network. Deserialization is the process of using a serialization to rebuild the original … Continue reading

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

Find a polygon union in C#

This example begins with two sample polygons pre-defined. Left-click to create the points for your own blue polygon and right-click to create the points for your own green polygon. Double-click to finish drawing a polygon. When two polygons are defined, … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , | 4 Comments

Solve the skyline problem in C#

In the “skyline problem” you are given a collection of rectangles all with a common baseline and the goal is to find an enveloping silhouette. The result looks like like the skyline for a city with a bunch of sky … Continue reading

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

Draw text on a curve in C#

The example Draw text on a line segment in C# shows how to draw text that follows a line segment. This example uses that code to draw text on a curve. The DrawTextOnPath method shown in the following code uses … Continue reading

Posted in algorithms, fonts, graphics | Tagged , , , , , , , , , , , , , , | Leave a comment

Display battery status in a friendly way in C#

The example Display battery status in C# shows how you can get the computer’s battery status. This example shows a couple of different ways you can display the battery’s status in user-friendly ways. First the program uses the following code … Continue reading

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

Draw text on a line segment in C#

This example shows how you can draw text on a line segment. The key is the DrawTextOnSegment method shown in the following code. This method can draw text on a line segment or below a line segment. // Draw some … Continue reading

Posted in algorithms, drawing, fonts, graphics, transformations | Tagged , , , , , , , , , , , , , , , | Leave a comment