Tag Archives: C#

Tile a bitmap with a string in C#

I recently needed a bitmap tiled with a string for a book I’m working on, so I wrote this program to make it. The program lets you click on the font name, dimensions, or colors to select those values. When … Continue reading

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

Color the solutions to the “Find the squares in C#” puzzle

The post Solve the “Find the squares in C#” puzzle explained how you can find solutions to the puzzle described in the post Puzzle: Find the squares in C#. This example shows how you can color the solutions so squares … Continue reading

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

Solve the “Find the squares in C#” puzzle

This post shows how to solve the puzzle Puzzle: Find the squares in C#. The program howto_square_puzzle_solution uses the following code to define the puzzle’s 11 solutions. // Small squares. Solutions.Add(new int[] { 0, 1, 4, 3 }); Solutions.Add(new int[] … Continue reading

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

Puzzle: Find the squares in C#

The example Puzzle: Find the equilateral triangles in C# was fun, at least for me, so here’s another puzzle. This time your goal is find all of the squares that you can make using the red dots shown here. If … Continue reading

Posted in algorithms, games, graphics, mathematics | Tagged , , , , , , , , , , , | 1 Comment

Save WriteableBitmap images in multiple formats in WPF and C#

The post Easily save a WriteableBitmap in WPF and C# describes an extension method that makes it easy to save a WriteableBitmap object into a PNG file, but what if you want to save the image in some other format … Continue reading

Posted in extension methods, graphics, image processing, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Easily save a WriteableBitmap in WPF and C#

In my post Save bitmap files in WPF and C# I lamented (okay, whined about) the cumbersomeness of saving a WriteableBitmap into a file in WPF. Fortunately there’s a way you can make it easier. Simply add an extension method … Continue reading

Posted in extension methods, graphics, image processing, wpf, XAML | Tagged , , , , , , , , , , , , , , , | 1 Comment

Easily manipulate pixels in WPF and C#

After building the example Save bitmap files in WPF and C#, I couldn’t get it out of my head. Doing the math to set the correct bytes in a one-dimensional pixel array isn’t all that hard, but it is annoying … Continue reading

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

Display team names for a round robin tournament in C#

The example Generate a schedule for a round robin tournament in C# explains how you can generate a schedule for a round robin tournament. This example simply adds the ability to display the schedule using the team names instead of … Continue reading

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

Save bitmap files in WPF and C#

This example shows how to use WPF and C# to save bitmap files. The example Set the pixels in a WPF bitmap in C# shows how to create a WriteableBitmap in WPF. This example shows how to save the resulting … Continue reading

Posted in files, graphics, image processing | Tagged , , , , , , , , , , , , , , , | 3 Comments

Draw different styles of “illuminated” text in C#

My previous post Draw “illuminated” text in C# showed how to draw “illuminated” text. It drew each paragraph’s initial letter in a large font with a box around it. Real illuminated manuscripts typically make the initial letter much more elaborate. … Continue reading

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