- 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
Programming the ProgressBar Control
The ProgressBar control gives your users a graphical representation of how an operation is progressing. This is useful when your application needs to perform a very time-consuming operation and you do not want the user to think the application has crashed or entered an endless loop.
The ProgressBar control is controlled by three Int32 properties: Minimum, Maximum, and Value. The Minimum and Maximum values define the minimum and maximum values of the ProgressBar control. The Value property defines the ProgressBar control's current value. The ProgressBar will be filled in from left to right as the Value property moves increasingly away from the Minimum value toward the Maximum value. The ProgressBar control is empty when the Value property is equal to the Minimum property. And once the Value property is equal to the Maximum value, the ProgressBar will be full. Immediately after the Value property is changed, the ProgressBar control will be repainted to reflect the new value.
Figures 3.11 and 3.12 show the BombSquad.exe game running in the Pocket PC 2002 emulator. The BombSquad game is a simple game that gives you a set amount of time to diffuse a dangerous bomb by clicking the Diffuse button before the ProgressBar control is filled. The Diffuse button's location continuously changes while the game is being played. Figure 3.11 shows the results of a successful diffusing, whereas Figure 3.12 shows what happens when you cannot diffuse the bomb in time. You will find the code for the BombSquad game in the source code for this book.
Figure 3.11 You win the BombSquad game by diffusing the bomb before the progress bar fills up.
Figure 3.12 You lose the BombSquad game by failing to diffuse the bomb before the progress bar fills up.