Monthly Archives: March 2019

Delete files from multiple folders quickly and easily in C#

The example Delete files quickly and easily in C# lets you make a list of files matching a pattern, check the files that you want deleted, and then delete them all quickly. Reader Uldis posted a comment asking how to … Continue reading

Posted in files, system | Tagged , , , , , , , , , , | Leave a comment

Use sines and cosines to draw circles and ellipses in C#

This example shows how you can use trigonometric functions to draw circles. It’s such a basic technique that I often forget that it’s not completely obvious to everyone. Given a radius R and an angle θ, the equations x = … Continue reading

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

“WPF 3d” code is avialable on GitHub

I have posted the source code for my book WPF 3d, Three-Dimensional Graphics with WPF and C# on GitHub in this repository. Feel free to download the examples and experiment with them. If you make any particularly interesting new images, … Continue reading

Posted in 3D, 3D graphics, books, graphics, three-dimensional graphics | Tagged , , , , , , , , , , | Leave a comment

Calculate the great circle distance between two latitudes and longitudes in C#

At a small scale, the world is relatively flat. At larger scale, however, is it roughly spherical. (Sorry flat-earthers.) That means the shortest distance between two points on the globe is not a straight line. (Unless you have amazing teleportation … Continue reading

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

Load Excel records into a DataGridView in C#

This example shows how you can load Excel records into a DataGridView control. You can use similar techniques to load Excel data into other controls such as other kinds of grid controls or a TreeView control. This example uses the … Continue reading

Posted in controls, database, Excel, interoperability | Tagged , , , , , , , , , , , , | 4 Comments

Make a picture with a transparent hole in it in C#

The example Create oval images in C# shows how to make a transparent image with an oval-shaped picture in it. This example shows how to do the converse: it makes an image with a transparent hole in the middle of … Continue reading

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

Let the user zoom on a picture and draw in C#

The example Let the user zoom on a picture in C# allows the user to zoom in on a picture and draw on it. Unfortunately, it doesn’t handle the drawing properly when the image is scaled. It doesn’t scale the … Continue reading

Posted in drawing, files, graphics, serialization, transformations | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment