- Investigating Unsupported Controls in the .NET Compact Framework
- Investigating Unsupported System.Windows.Forms Functionality in the .NET Compact Framework
- Working with the Visual Studio .NET Form Designer
- Understanding the Different Windows Forms Target Platforms
- Working with the Form Control
- Programming the Button Control
- Using the TextBox Control
- Using the Label Control
- Working with RadioButton Controls
- Using the CheckBox Control
- Using the ComboBox Control
- Using the ListBox Control
- Using the NumericUpDown Control
- Using the DomainUpDown Control
- Programming the ProgressBar Control
- Using the StatusBar Control
- Using the TrackBar Control
- Using the ToolBar Control
- Adding Menus with the MainMenu Control
- Using a ContextMenu Control in an Application
- Using the Timer Control
- Using the OpenFileDialog and SaveFileDialog Controls
- Using the Panel Control
- Using the HScrollBar and VScrollBar Controls
- Using the ImageList Control
- Using the PictureBox Control
- Using the ListView Control
- Using the TabControl Control
- Using the TreeView Control
- Working with the DataGrid Control
- In Brief
Using the TrackBar Control
The TrackBar control is a special slider control that allows the user to select a numeric value by changing the position of the slider. The TrackBar is controlled mainly by three properties: Minimum, Maximum, and Value. Given our earlier discussions, these values are self-explanatory.
The TrackBar exposes a few additional properties that control the appearance and behavior of the TrackBar. The Orientation property determines whether the TrackBar is oriented on the horizontal or vertical axis. The TickFrequency property defines the distance between the tick marks along the slider. By default the TickFrequency is set to one. The SmallChange and LargeChange properties define increment values. SmallChange defines how much the Value is incremented when the user presses one of the Pocket PC navigation pad arrow keys. The LargeChange property defines how much the Value is incremented when the user clicks the TrackBar on either side of the slider.
When the TrackBar controls value is changed, a ValueChanged event is fired. You can handle this event to update whatever properties that are linked to the TrackBar. Figure 3.14 shows two TrackBars that are identical except that one is oriented vertically and the other horizontally. The horizontal TrackBar controls the vertical, meaning that the value of the vertical TrackBar control will change to match the value of the horizontal TrackBar control.
Figure 3.14 An application that showcases the TrackBar control running on the Pocket PC 2002 emulator.