view ServerMonitor/Controls/SizeUnitsComboBox.cs @ 34:9c0e18d65e8b

Build NuGet from source instead of using the NuGet package to fix the update notification always showing when the program is run from Windows startup.
author Brad Greco <brad@bgreco.net>
date Sat, 13 Jul 2019 12:09:10 -0400
parents 68d7834dc28e
children
line wrap: on
line source

using System.Windows.Forms;

namespace ServerMonitorApp
{
    /// <summary>Combo box containing options for size units.</summary>
    class SizeUnitsComboBox : ComboBox
    {
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            // Clear the items to prevent duplicates added at design time and run time.
            Items.Clear();
            Items.Add("B");
            Items.Add("KB");
            Items.Add("MB");
            Items.Add("GB");
            SelectedIndex = 0;
        }
    }

    /// <summary>Size units.</summary>
    /// <remarks>The integer values must equal the power of 1024 needed to convert from bytes to each unit.</remarks>
    public enum SizeUnits { B = 0, KB = 1, MB = 2, GB = 3 }
}