Tag Archives: GraphicsPath

Get font size in pixels in C#

One oddity of the Font class is that its Size property returns font size in the units that were used to create the font. The Font class’s Unit property tells you the units used to create the font, but if … Continue reading

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

Draw smooth text in a GraphicsPath in C#

You can set a Graphics object’s TextRenderingHint property to AntiAliasGridFit to draw smooth text. However, if you place text in a GraphicsPath object and draw the GraphicsPath, then the TextRenderingHint property doesn’t give you smooth text. Instead you need to … Continue reading

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

Use base insets with custom end caps in C#

The example Draw lines with custom end caps in C# shows how to draw lines with custom end caps. For example, using those techniques you can draw lines with arrowheads or circles at the ends. The coordinate system for drawing … Continue reading

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

Make shaped PictureBoxes in C#

This example shows how to use regions to make shaped PictureBoxes. The PNG image format allows you to define transparent pixels. As you might guess, if you draw an image with transparent pixels, those pixels are not drawn and whatever … Continue reading

Posted in algorithms, geometry, graphics, image processing | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Fill a shape with random lines in C#

Click and drag to draw a shape. When you release the mouse, the program closes the shape and fills it with random line segments. The following code shows how the program lets you draw a shape. // The points selected … Continue reading

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

Make a selection dialog that uses a color wheel in C#

The example Draw a color wheel with alpha and saturation values in C# lets the user select a color on a color wheel. This example uses that technique to build a color selection dialog. This change is fairly easy. First … Continue reading

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

Draw a color wheel with alpha and saturation values in C#

The example Draw a colorful color wheel in C# shows how to draw a color wheel. This example lets you use scroll bars to change the alpha (opaqueness) and saturation (grayness) values of the colors. This is actually a pretty … Continue reading

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

Find the area where circles overlap in C#

This example shows how you can find the area where circles overlap in a .NET program. The example Determine where two circles intersect in C# shows how to find the points where two circles intersect. Finding the area where more … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , | 5 Comments

Draw text filled with random colored circles in C#

This example shows how to draw text filled with random colored circles. The example Draw text filled with random colored lines in C# shows how to draw text filled with random colored lines. This example is similar except it fills … Continue reading

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

Draw text filled with random colored lines in C#

This example combines two previously described techniques to draw text filled with random colored lines. The example Draw text filled with random lines in C# shows how to draw text filled with random lines. The example Draw text in random … Continue reading

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