Author Archives: Rod Stephens

Give an image a transparent background in C#

The Bitmap class’s MakeTransparent method changes all of the pixels with a given color to the transparent color A = 0, R = 0, G = 0, B = 0. When the program starts, the following code makes the background … Continue reading

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

Make a TextBox convert text into proper case in C#

The example Convert a string to proper case (title case) in C# uses a CultureInfo object’s TextInfo property to convert text into proper case (or title case). There are a couple of tricks and potential problems that you need to … Continue reading

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

Convert a string to proper case (title case) in C#

In proper case (or title case) the first letter of each word is capitalized. This is actually pretty easy once you know where to find the method that converts to proper case. The example uses the following code to convert … Continue reading

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

Make TextBoxes automatically convert case in C#

It’s actually quite easy to make a TextBox convert case in .NET. Simply set the TextBox control’s CharacterCasing property to Lower or Upper. Then the control automatically converts alphabetic characters into the correct case. You can do this at design … Continue reading

Posted in controls, strings, user interface | Tagged , , , , , , , , , , , , | Leave a comment

See if Internet Explorer uses a proxy in C#

This example determines whether the system has Internet Explorer configured to use a proxy. Internet Explorer lets you specify proxy settings. In the Tools menu, select Internet Options. On the Connections tab, click the LAN Settings button. The goal of … Continue reading

Posted in internet, network, system | Tagged , , , , , , , , , , | Leave a comment

Move a window with a title that matches a pattern in C#

The example Set another application’s size and position in C# uses the FindWindow API function to find a window with a given title. Unfortunately FindWindow only finds the window if the title is an exact match. If you only know … Continue reading

Posted in API, miscellany, regular expressions, system | Tagged , , , , , , , , , , , , | Leave a comment

Tile desktop windows in rows and columns in C#

The example List desktop windows in C# shows how to list the currently running desktop windows. This example uses that technique to fill a ListBox with the titles of those desktop windows. (See the previous example to see how that … Continue reading

Posted in API, miscellany, system | Tagged , , , , , , , , , , , | Leave a comment

Set another application’s size and position in C#

When I write books, there is usually a maximum size that a screen shot can be. I wrote this program to make it easy to set an example program to exactly that size. This program uses the FindWindow API function … Continue reading

Posted in API, miscellany, system | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , | 3 Comments

Find a target window and minimize, maximize, or restore it in C#

This is the first in a series of posts that allow one application to manipulate a target window in another application. Note that this isn’t something that Microsoft really wants you to do. In general one application should not fiddle … Continue reading

Posted in API, miscellany, system | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Make a stopwatch in C#

This program is a simple stopwatch. When you click the Start button, the program changes the button’s caption to Stop and starts a Timer. As the stopwatch Timer runs, the program displays the elapsed time. Click the Stop button to … Continue reading

Posted in internationalization, miscellany, strings | Tagged , , , , , , , , , , , , , | Leave a comment