Tag Archives: miscellany

Use accelerators on labels and buttons in C#

To place an accelerator on a menu item, you put an ampersand in front of the letter in the menu item’s caption that you want to be the accelerator. At run time, the caption is displayed with the accelerator letter … Continue reading

Posted in miscellany, productivity | Tagged , , , , , , , , , , , | Leave a comment

Activate another running program in C#

This is actually quite simple. First add a reference to the Microsoft.VisualBasic library. Then call Microsoft.VisualBasic.Interaction.AppActivate, passing it the title of the program that you want to activate as in the following code. using Microsoft.VisualBasic; … // Activate the program. … Continue reading

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

Use System.Threading.Timer to make a countdown timer in C#

The post Make a countdown timer in C# uses a Timer control to count down the time until some deadline. This example does something similar but it uses a Timer object from the System.Threading namespace. The basic idea is similar: … Continue reading

Posted in miscellany, 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

Hints for beginners without sacrificing efficiency

In my previous post, The ribbon interface: sacrificing usability for discoverability, I explain that the ribbon interface makes it easier for beginners to wander through an application’s features to discover what tools are available but that it makes it harder … Continue reading

Posted in miscellany, tips, user interface, Windows Forms programming | Tagged , , , , , , , , , , , , | Leave a comment

The ribbon interface: sacrificing usability for discoverability

Unlike my usual examples, this post is a discussion of an important design technique: providing information for beginners without sacrificing efficiency for more experienced users. Next time I’ll post a follow-up and then get back to examples after that. In … Continue reading

Posted in miscellany, tips, user interface, Windows Forms programming | Tagged , , , , , , , , , , , , | 2 Comments