Tag Archives: Windows Forms programming

Tile a board with colored trominoes in C#

The post Tile a board with trominoes in C# explains how to tile a board with a missing square with trominoes. This post shows how to color the trominoes so no two adjacent ones share the same color. The four-color … Continue reading

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

Tile a board with trominoes in C#

Trominoes are polyominoes of order three. That means they are polygons made up of three equal sized squares joined at their edges. There only are two kinds of trominoes: three squares joined in a line and three squares joined in … Continue reading

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

Draw text wrapped to fit columns in C#

The post Draw aligned columns of data in C# shows one way to draw text in rows and columns. It uses the Graphics class’s MeasureString method to size the columns so they are big enough to display their data without … Continue reading

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

Draw a randomly colored Sierpinski pentagon in C#

The example Draw a colored Sierpinski pentagon in C# lets the user click on the parts of a Sierpinski pentagon to change their colors. Eddie Bole thought it would be interesting to color the larger pentagons in addition to the … Continue reading

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

Draw a colored Sierpinski pentagon in C#

The example Draw a Sierpinski pentagon in C# shows how to draw a Sierpinski pentagon. This example modifies that one so the user can click on pentagons to change their colors. To do that, this program takes a very different … Continue reading

Posted in drawing, fractals, graphics, recursion | Tagged , , , , , , , , , , | 5 Comments

Initialize TextBox contents for the computer’s locale in C#

Suppose you place numeric, currency, date, and time values in TextBox controls at run time. At design time, the program may have trouble reading those values if the computer running the program is not using the same locale that you … Continue reading

Posted in formatting, internationalization, localization | Tagged , , , , , , , , | Leave a comment

Use label controls to draw a simple labeled histogram in C#

The example Draw a simple labeled histogram in C# draws a labeled histogram on a PictureBox in that control’s Paint event handler. It does a fair amount of work to ensure that the histogram’s bars are in their proper positions … Continue reading

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

Draw a simple labeled histogram in C#

The example Make a simple histogram in C# shows how to draw a simple histogram on a PictureBox. This example adds Label controls above the histogram’s bars. When the program loads, it uses the following code to generate some random … Continue reading

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

Rename files after their modification dates in C#

Lately I’ve been creating one file a day and I wanted to rename the files after their modification dates. Something like “File 04-01-20.jpg.” So I wrote this program to do that. Enter the directory that you want to search, a … Continue reading

Posted in files | Tagged , , , , , , , , | 2 Comments

Find a Ducci sequence in C#

A Ducci sequence is a sequence of tuples of integers. You start with a sequence of values such as 1-2-3-4-5. TO find the next tuple, you calculate the absolute value of the difference between adjacent numbers in the sequence, wrapping … Continue reading

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