Category Archives: algorithms

Find drawn characters under the mouse in C#

The following examples find the positions of drawn characters in a string that is drawn by using the Graphics object’s DrawString method. Measure character positions in a drawn string in C# Measure character positions when drawing long strings in C# … Continue reading

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

Let the user draw rotated skewed polygons in C#

The example Let the user draw rotated polygons with right angles in C# draws polygons with edges that are parallel or perpendicular to a baseline. This example is very similar except its polygons have edges that are parallel to one … Continue reading

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

Let the user draw rotated polygons with right angles in C#

This example lets the user draw rotated polygons where all edges are either parallel or perpendicular to a defined baseline direction. As a result, all of the polygon’s angles are right angles. (And yes, I know that the polygons aren’t … Continue reading

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

Draw interlocked circles in C#

This example draws a set of interlocked circles so they alternate between above and below each other. As you can see from the picture, the circles are made up of colored lines with black outlines so it’s easy to see … Continue reading

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

Make an Apollonian gasket filled with images in C#

This example shows how to draw an Apollonian gasket filled with images of a cat. (I promise that this will be my last cat fractal for a while, although I may have one other cat image post coming up. ;-)) … Continue reading

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

See which section is under the mouse in a sunburst chart in C#

My earlier post Make a sunburst chart in C#, Part 4 shows how you can draw a sunburst chart. This example shows how you can tell which section the mouse is over when you move the mouse over the chart. … Continue reading

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

Flow words around drop caps in C#

The example Flow blocks around obstacles for document layout in C# implements a document layout algorithm that flows blocks around obstacles. Moving from there to flowing words around obstacles is relatively simple. The following sections describe the main places where … Continue reading

Posted in algorithms, fonts, graphics, strings | Tagged , , , , , , , , , , , , | 2 Comments

Flow words around obstacles for document layout in C#

The example Flow blocks around obstacles for document layout in C# implements a document layout algorithm that flows blocks around obstacles. Moving from there to flowing words around obstacles is relatively simple. The following sections describe the two main places … Continue reading

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

Flow blocks around obstacles for document layout in C#

The following two document layout examples draw “illuminated” text by using an initial or drop cap. Draw different styles of “illuminated” text in C# Draw “illuminated” text in C# Martin asked how we could do something similar when the text … Continue reading

Posted in algorithms, fonts, graphics, strings | Tagged , , , , , , , , , , , , | 2 Comments

Give an image an improved transparent background in C#

This example lets you make some pixels in an image part of a transparent background. Use the File menu to open an image file. When you click on the original image on the left, the program converts pixels that have … Continue reading

Posted in algorithms, graphics, image processing | Tagged , , , , , , , , , , , | Leave a comment