Category Archives: controls

Use a FileSystemWatcher to build a spooler in C#

This example uses a FileSystemWatcher to implement a spooling program. SPOOL is an ancient computer acronym dating from the 1950s that stands for “Simultaneous Peripheral Operations On-Line.” It is a technique in which jobs are placed in a queue in … Continue reading

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

Display database pictures in a ListView control in C#

This example shows how you can display database pictures in a ListView control. My previous post, Create ListView icons at run time in C#, explained how to make images at runtime to display in a ListView control. This example follows … Continue reading

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

Create ListView icons at run time in C#

The example Display large and small ListView icons in C# explains how to display ListView icons next to items. Basically, you place the images in two ImageList controls, set the ListView control’s LargeImageList and SmallImageList properties to those two controls, … Continue reading

Posted in controls, drawing, graphics | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Let the user select the ScrollBar maximum in C#

You would think that allowing the user to select the ScrollBar maximum would be the default behavior. Unfortunately, that’s not the case. The behavior of the VScrollBar and HScrollBar controls is largely determined by their Value, Minimum, Maximum, SmallChange, and … Continue reading

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

Display icons next to ListView sub-items in C#

This example displays icons next to ListView sub-items when the ListView is in Detail View. This requires two steps beyond what is required to make a ListView display item icons: (1) assigning image indices to the sub-items, and (2) making … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , , , , | 3 Comments

Display large and small ListView icons in C#

You can display two sizes of ListView icons. When the control’s View property is LargeIcon or Tile, the control displays large icons. When the View property is SmallIcon, List, or Details, the control displays small icons. The control gets its … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , , , | 3 Comments

Make a PictureBox act like a button in C#

This program uses several images to make a PictureBox behave like a button. These images give you complete control over how the “button” looks as it is pressed and released. A button should have these behaviors: When the mouse is … Continue reading

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

Display a horizontal scrollbar in a ListBox in C#

Displaying a horizontal scrollbar is easy but useful. If you need to display some long values in a ListBox, you may want to be able to scroll to the right to see the ends of the values. For example, this … Continue reading

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

List Dictionary keys and values in C#

A Dictionary object’s Keys property is a KeyCollection containing the dictionary’s keys. Similarly, its Values property is a ValueCollection containing the dictionary’s values. These collections are slightly different from the List objects that you probably use in your code. In … Continue reading

Posted in algorithms, controls, lists | Tagged , , , , , , , , , , , , | Leave a comment

Resize a RichTextBox to fit its contents in C#

This example shows how you can resize a RichTextBox control so it fits the text and images that it contains. The example Resize a TextBox to fit its text in C# shows how to make a TextBox fit its text. … Continue reading

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