Tag Archives: user interface

Use a symbiote to graphically select hours in C#

This example modifies the previous example Graphically select hours in C# so it uses a symbiote class. That example shows how to use a PictureBox to let the user select a range of hours. If you want to let the … Continue reading

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

Graphically select hours in C#

The DateTimePicker control lets you select dates and date ranges, but there’s no standard control that lets you select hours. This example shows one way to do this with a PictureBox. A big part of this program is the DrawHours … Continue reading

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

Make the user enter a float in C#

The posts Preview TextBox changes in C# and Preview TextBox changes in C#, Part 2 show how you can make a TextBox accept only integers. This example is similar except it makes a TextBox only accept floats. This change is … Continue reading

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

Preview TextBox changes in C#, Part 2

Part 1 of this post explained how the example previews changes made by keyboard events. It then accepts or cancels the changes depending on whether the TextBox control’s new value is a valid integer (or the start of one as … Continue reading

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

Preview TextBox changes in C#

One of the more annoying omissions from the Windows Forms controls is a way to preview changes to a TextBox before they occur. For example, suppose you want the user to enter a floating point value in a TextBox. The … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , , | 2 Comments

Safely manage documents in C#

This is a pretty involved example that shows how to safely manage documents. The pieces are all simple but there are a lot of tightly integrated pieces. This example lets you create, edit, open, and save files in text and … Continue reading

Posted in files, forms, user interface | Tagged , , , , , , , , , , , , , , , , | 1 Comment

Make Ctrl+A select all of the text in a TextBox in C#

Often it’s convenient for the user to be able to press Ctrl+A to select all of the text in the TextBox that has the focus. Strangely that’s not the default behavior for the TextBox. Perhaps the TextBox doesn’t handle Ctrl+A … Continue reading

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

Use a ProgressBar in C#

This example shows how to use a ProgressBar to show the progress of a long task. This is a very simple example that performs a synchronous task. I created the ProgressBar at design time. I left its Minimum property set … Continue reading

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

Make pop buttons in C#

This example produces an interesting visual effect that I call “pop buttons.” The buttons grow and shrink when the mouse moves over them. The technique is remarkably simple and adds some extra interactivity to an otherwise ordinary program. The program’s … Continue reading

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

Display reusable dialog forms in C#

The example Make a dialog with standard dialog features in C# shows the most common approach to making dialogs. Whenever it needs to display the dialog, the main program initializes a new instance of it and displays it. If the … Continue reading

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