Monthly Archives: July 2016

Drag a map to scroll in C#

This example shows how you can allow a user to drag a map to scroll to hidden parts of it. Scroll bars provide a simple method for allowing the user to view parts of a map that don’t fit on … Continue reading

Posted in drawing, graphics, image processing, mathematics | Tagged , , , , , , , , , , , , , , , | 3 Comments

Define map hotspots in C#

The example Display a scalable map with hotspots in C# uses a list of hotspots defined by the following code. // The hotspots. private List Hotspots = new List(); … // Prepare the map for first viewing. private void Form1_Load(object … Continue reading

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

Display a scalable map with hotspots in C#

Making a scalable map with hotspots is surprisingly easy, although getting the details right is a bit tricky. The program displays a map at several different scales. If the map won’t fit on the form at the current scale, it … Continue reading

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

Display text on a ProgressBar in C#

It would be nice if you could display a progress message on top of a ProgressBar. Unfortunately you can’t do that. You can’t even put a label above a ProgressBar without covering it so you can’t see the progress. An … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , | 1 Comment

Draw justified text in C#

The StringFormat class has Alignment and LineAlignment properties that let you draw justified text. They let you specify how you want text aligned vertically and horizontally. The Alignment property determines the text’s horizontal alignment and the LineAlignment property determines its … Continue reading

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

Display map distance with limited significant digits in C#

The post Measure distance on a map with a scale in C# lets you measure a distance on a map. However, it displays too many significant digits in the results to look nice. For example, the sample picture displays the … Continue reading

Posted in algorithms, extension methods, graphics, mathematics, strings | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Display significant digits in C#

The number of significant digits in a number is the number of digits that carry meaningful information. These include all of the digits displayed except leading and trailing zeros. A decimal point and trailing zeros after the decimal point imply … Continue reading

Posted in algorithms, extension methods, mathematics, strings | Tagged , , , , , , , , , , | Leave a comment

Measure distance on a map with a scale in C#

Recently I wanted to measure the distance around my local park. If you look at Google Maps, you can find maps of just about anywhere with the scale shown on them. This application lets you load such a map, use … Continue reading

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

Align numeric values in ComboBox and ListBox controls in C#

The example Sort partly numeric items in a ComboBox or ListBox in C# displays a list of values that begin with numbers. Unfortunately the text doesn’t line up nicely in the result. This example solves that problem by using a … Continue reading

Posted in controls, fonts | Tagged , , , , , , , , , , , | Leave a comment

Sort partly numeric items in a ComboBox or ListBox in C#

The example Use a custom sort order for ListBox or ComboBox items in C# shows how to sort numeric values. This example uses the same basic approach: make an array of values, sort them as you want them displayed, and … Continue reading

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