Category Archives: controls

Make a custom component in C#

There are a couple of ways that you can approach this problem. In this post, I’ll describe two: subclassing from Component and making a control that is invisible at runtime. Subclassing From Component To make a true component, simply make … Continue reading

Posted in controls | Tagged , , , , , , , | 1 Comment

Display a progress bar with text in WPF and C#

As is so often the case in WPF, the solution is simple after you spend a few hours figuring out what controls to use. This example uses a normal Grid control that holds a StackPanel. The following code shows the … Continue reading

Posted in controls, user interface, wpf, XAML | Tagged , , , , , , , , , , , , , | 1 Comment

Copy ListView data into an array in C#

This example uses the following ListView extension method to copy ListView data into a two-dimensional array of strings. // Return the ListBox’s contents in a string[,]. public static string[,] GetListViewData(this ListView lvw) { // Get the number of rows and … Continue reading

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

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 , , , , , , , , , , , , | 2 Comments

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 , , , , , , , , , , , , , , , , | 2 Comments

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