Category Archives: user interface

Quickly insert standard menu items on a form in C#

Many applications need standard File, Edit, Tools, and Help menus. Visual Studio provides a simple way to build standard menu items. You can then edit the menu to add new items and remove items that you don’t need. Visual Studio … Continue reading

Posted in menus, user interface | 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

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

Override WndProc to see when the user clicks any control on a form in C#

A form’s WndProc method processes messages sent to the form by the Windows operating system. This is an extremely important method that allows forms to move, resize, repaint, and perform other critical operations. While you normally don’t need to change … Continue reading

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

Center the cursor over a particular control in C#

Some programs move the mouse to center the cursor over a particular control to make some sort of selection easier. For example, it might move the mouse over a dialog’s OK button. Personally I find that annoying as a user, … Continue reading

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

Simulate mouse movement and clicks in C#

This program uses the mouse_event API function to simulate mouse movement and to simulate a mouse click. The program’s Paint event handler draws some circles around a target point so you can see where it is. // The mouse’s target … Continue reading

Posted in API, miscellany, user interface | Tagged , , , , , , , , , , , , | 1 Comment

Make an OwnerDraw ListView in C#

Normally a ListView displays textual data, but you can change that behavior to make it display anything that you can draw. This example draws images and colored circles to show the status of fictional servers. The idea is to set … Continue reading

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

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

Make two forms open each other in C#

This is sort of a beginner’s exercise in making two forms work with each other, although it raises some non-beginner issues. Beginners often want to have two forms (or more) open each other. Unfortunately this is surprisingly confusing in C#. … Continue reading

Posted in forms, user interface | Tagged , , , , , , , , , , , | Leave a comment