Section 3
- Part 3
Enhancing Usability- Topic 1
Create, configure, and customize user assistance controls and components.
- Configure the PropertyGrid component.
- Configure the ProgressBar control to indicate progress graphically.
- Display status information by using the StatusStrip control.
- Configure the ToolTip component.
- Configure the ErrorProvider component.
- Configure the HelpProvider component.
- Play system sounds and audio files by using the SoundPlayer.
- Configure the Timer component to raise an event at regular intervals.
- Enable scrolling by using the HScrollBar and VScrollBar controls.
Summary
The PropertyGrid Component is new to ,Net 2.0 and acts much like the property grid in the Visual Studio IDE. It exposes a selectedObject property and uses reflection to display its properties.
The ProgressBar Component has three different display styles out of the box: Segmented Blocks, a Continuous bar, And a Scrolling Bar (Marquee like display). The Component Exposes Minimum and Maximum properties, a value property for the current progress, It also exposes a perform step method for incrementing the value.
The StatusStrip control replaces the StatusBar Control. Besides the regular functionality you can now add a progress bar, dropdown button, split button, and label to the control easily.
The ToolTip component allows you to provide hints when the user puts their mouse on any container. You can use one tooltip component for many controls on the same form. You can set the delays, and then call the SetToolTip Method of the component to assign tips to other controls (ex. ToolTip1.SetToolTip(this.button1, “A Button Tool Tip”); )
The ErrorProvider Control enables you to alert the user to a problem with another control. You can manually call the setError method passing the control and the error message, but the beauty of this control is the fact that you can databind it to a datatable. Each Data Row exposes a RowError property and columns have a columnerror property. When the errorProvider is bound, the rows are checked and the messages are displayed.
The HelpProvider component is used to display messages to the user when they click F1 in a control. The messages are associated with the HelpProvider in similar fashion to the tooltip component mentioned earlier.
The soundplayer component can be used to play wav files. There is no UI for this component. Sounds are played from streams or files, synchronously or asyncronously
The timer component is used to perform tasks at configured intervals. The component exposes a interval property and Tick Event that Event Handlers can subscribe to perform actions at each interval.
The HScrollBar and VScrollBar Classes are used for controls that do not provide their own scrollbars. Textboxes, listboxes and comboboxes already have this functionality and do not need these components. It is needed for containers like PictureBox, or can be used on its own to capture numeric data.
Other Resources & Links:
PropertyGrid Class
http://msdn2.microsoft.com/en-us/library/system.windows.forms.propertygrid.aspx
Progress Bar Class
http://msdn2.microsoft.com/de047043(en-US,VS.80).aspx
Windows Forms 2.0 StatusStrip Control
http://www.c-sharpcorner.com/Code/2004/Sept/StatusStrip.asp
ToolTip Class
http://msdn2.microsoft.com/ecft989x(en-US,VS.80).aspx
ErrorProvider Class
http://msdn2.microsoft.com/tyyw74ed(en-US,VS.80).aspx
HelpProvider Class
http://msdn2.microsoft.com/9ac114kt(en-US,VS.80).aspx
SoundPlayer
http://www.windowsforms.net/WhidbeyFeatures/default.aspx?PageID=2&ItemID=11&Cat=Runtime&tabindex=5
Timer Class
http://msdn2.microsoft.com/xdh6857z(en-US,VS.80).aspx
HScrollBar Class
http://msdn2.microsoft.com/99z9yedb(en-US,VS.80).aspx
VScrollBar Class
http://msdn2.microsoft.com/5ebt5dzb(en-US,VS.80).aspx