9
|
1 using System.Windows.Forms;
|
3
|
2
|
|
3 namespace ServerMonitorApp
|
|
4 {
|
9
|
5 /// <summary>Combo box containing options for size units.</summary>
|
3
|
6 class SizeUnitsComboBox : ComboBox
|
|
7 {
|
|
8 protected override void OnCreateControl()
|
|
9 {
|
|
10 base.OnCreateControl();
|
9
|
11 // Clear the items to prevent duplicates added at design time and run time.
|
3
|
12 Items.Clear();
|
|
13 Items.Add("B");
|
|
14 Items.Add("KB");
|
|
15 Items.Add("MB");
|
|
16 Items.Add("GB");
|
|
17 SelectedIndex = 0;
|
|
18 }
|
|
19 }
|
|
20
|
9
|
21 /// <summary>Size units.</summary>
|
17
|
22 /// <remarks>The integer values must equal the power of 1024 needed to convert from bytes to each unit.</remarks>
|
3
|
23 public enum SizeUnits { B = 0, KB = 1, MB = 2, GB = 3 }
|
|
24 }
|