TrackBar control
The Trackbar control provides a way to adjust a numeric setting using a mouse. It is sometimes also called a "slider". We have a short line marked with tick points and an indicator we can move left or tight using the mouse.
The properties of TrackBar include:
Process class
The Process class is used to start a new process, that is, a new running application. It has a large number of properties and methods. We shall look at only a few.
While there are constructors, a common way to start a process is to use a static method:
Process.Start(String FileName);
where FileName is the name (and perhaps the path) of the application desired. This is similar to typing the name in the Run dialog box of the Windows Start menu.
Thus we might have:
Process.Start("IExplore.exe");
to launch Internet Explorer.
An alternative is to provide command-line parameters as well:
Process.Start(String FileName, String Parameter);
We might have:
Process.Start("IExplore.exe", "www.cs.niu.edu");
The Process class can also be used by creating a Process instance, supplying information as the values of properties, and then simply using Start() (which, with no parameters, is not static). This is more flexible. We have access to properties such as:
MonthCalendar Control
The MonthCalendar control provides a calendar in the form for one or more months. The user can scroll forward and backward through the months.
It is possible to provide a list of dates to be displayed in bold type. There are properties to affect the appearance: font, size, colors, etc.
DateTimePicker Control
The DateTimePicker control allows a user to select a date and time. It displays the current date (by default) and has a drop-down option to produce a monthly calendar to select a different date.
Two of the properties are Value and Text. The relationship between these is the CustomFormat property. The value of the Text property is what we have when the CustomFormat (a string indicating what we want) is applied to Value. For instance, if the Value property is set to 06/01/2001 12:00:00 AM and the CustomFormat property is set to "dddd, MMMM dd, yyyy", the Text property value will be "Friday, June 01, 2001".
NumericUpDown Control
The NumericUpDown control is also known as a "spin box". It displays a numeric value with a pair of up/down arrows that allow the user to increase or decrease the value.
Some of the NumericUpDown's properties are:
Of course, there are also properties for the size, position, font, color scheme, etc.
The most useful event associated with a NumericUpDown control is ValueChanged.
CheckBox Control
The CheckBox control is used to give the user a choice of two options such as on/off or true/false. It is in some sense a relative of a Button.
The most useful property of a CheckBox is Text, a string. This is displayed on the control, and we have reset it as needed.
The most useful event associated with a CheckBox is CheckedChanged.
Of course, there are also properties for the size, position, font, color scheme, etc.
ColorDialog class
The ColorDialog class provides a way for the user to choose a color which is then available as the Color property of the ColorDialog class. Normally it is created on the fly:
ColorDialog MyDialog = new ColorDialog();
and we set some of its properties. A color-picking dialog box pops up, the users uses it, and it goes away.
Two of the properties are:
OpenFileDialog Class
The OpenFileDialog class provides a dialog box that allows a user to check on whether a file exists and to open it. The user can type in a filename to search for or browse to find a filename.
Properties include:
There are more properties; for instance, the Filter property gets or sets a string to limit the types of files involved.
The dialog box may or may not contain a "read-only" checkbox. It will do so if the ShowReadOnly property is set to true. (The default is false.) The ReadOnlyChecked property, a bool, indicated whether the read-only checkbox has been selected (true) or not (false). (The default is false.)
One of the methods is:
Stream OpenFile()
which opens the file specified by FileName with read-only permission. If we want read/write permission, we will have to open the file by some other method.
There are also SaveFileDialog and PrintFileDialog classes. Both of these and OpenFileDialog are inherited from the FileDialog class.
FontDialog Class
The FontDialog class provides a dialog box enabling the user to select a font including size and effects such as boldface or italics.
The most important property is Font, of type Font, which identifies the user's choice.
Other properties include MaxSize and MinSize, integers, that control the maximum and minimum point sizes allowed.
The ShowColor property, a bool, indicates whether the dialog box includes an option to choose a color. The Color property, of type Color, indicates the user's choice (default = Black).