Tag Archives: Windows Forms programming

Center text above or below a line segment in C#

My post Draw text on a line segment in C# shows how to draw text above or below a line segment, but that technique does not work very well if you want to center text over the segment. That post … Continue reading

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

Resize images in C#

You can use MS Paint to easily resize images. Unfortunately, it won’t preserve transparency if you save the result. I often need to resize transparent images so I finally got around to writing this example. It lets you resize images … Continue reading

Posted in drawing, graphics, image processing | Tagged , , , , , , , , , | 4 Comments

Combine image slices in C#

After my recent post Adjust an image’s opacity in C#, I realized that it might be interesting to combine slices from different versions of an image saved with different opacities. I did’t really need to do this; it just seemed … Continue reading

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

Adjust an image’s opacity in C#

I recently wanted to reduce an image’s contrast by adjusting its opacity. If you draw a semi-transparent image on top of a white background, the result looks washed out so it can act as a background for text or whatever. … Continue reading

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

Find hexes a certain distance from a target hex in C#

My post Draw a hexagonal grid in C# shows how you can draw a grid made up of hexagons. This post shows how you can find the hexes that are a given distance N from a target hex. Basic Idea … Continue reading

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

Let the user draw a polyline in WPF and C#

This example shows how you can let the user use the mouse to draw a polyline in and WPF application in C#. I often badmouth WPF by saying that it is “twice as flexible and only ten times as hard” … Continue reading

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

Let the user draw, move, and modify an arc in C#, Part 2

My previous post Let the user draw, move, and modify an arc in C#, Part 1 describes an Arc class that allows a program to draw arcs. This post explains how the example program uses that class to let the … Continue reading

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

Let the user draw, move, and modify an arc in C#, Part 1

The example See whether a point is above an arc in C# shows how you can find the part of an arc at a particular position. This example uses the techniques described in that one to allow the user to … Continue reading

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

See whether a point is above an arc in C#

This example shows how you can determine which part of an arc is at a particular position. If you move the mouse over the arc’s start or end point, the program changes its cursor to the PanWest and PanEast cursors. … Continue reading

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

Make a pie slice drawing extension in WPF and C#

This example shows how to make an extension method to draw a pie slice easily in WPF and C#. My post Make an intuitive extension method to draw an elliptical arc in WPF and C# shows how to make an … Continue reading

Posted in drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , | Leave a comment