comparison ServerMonitor/Controls/SizeUnitsComboBox.cs @ 9:7127d5b5ac75

Code cleanup and comments
author Brad Greco <brad@bgreco.net>
date Mon, 08 Apr 2019 21:29:54 -0400
parents 96f0b028176d
children 68d7834dc28e
comparison
equal deleted inserted replaced
8:052aa62cb42a 9:7127d5b5ac75
1 using System; 1 using System.Windows.Forms;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows.Forms;
6 2
7 namespace ServerMonitorApp 3 namespace ServerMonitorApp
8 { 4 {
5 /// <summary>Combo box containing options for size units.</summary>
9 class SizeUnitsComboBox : ComboBox 6 class SizeUnitsComboBox : ComboBox
10 { 7 {
11 protected override void OnCreateControl() 8 protected override void OnCreateControl()
12 { 9 {
13 base.OnCreateControl(); 10 base.OnCreateControl();
11 // Clear the items to prevent duplicates added at design time and run time.
14 Items.Clear(); 12 Items.Clear();
15 Items.Add("B"); 13 Items.Add("B");
16 Items.Add("KB"); 14 Items.Add("KB");
17 Items.Add("MB"); 15 Items.Add("MB");
18 Items.Add("GB"); 16 Items.Add("GB");
19 SelectedIndex = 0; 17 SelectedIndex = 0;
20 } 18 }
21 } 19 }
22 20
21 /// <summary>Size units.</summary>
23 public enum SizeUnits { B = 0, KB = 1, MB = 2, GB = 3 } 22 public enum SizeUnits { B = 0, KB = 1, MB = 2, GB = 3 }
24 } 23 }