I present the user a NumericUpDown control so he can specify the size of a texture. It is important that this texture is of power of two size (32, 64, 128...).
I hav
Hmm, well you could make your own. Using a textbox and a couple picture boxes you can set up a form that sets only powers of two.
My suggestion is to use a ComboBox
, you will have your numbers dropped down, you support auto complete and at the same time escape the validation of user input, code like:
//generate your array.
List<string> twos = new List<string>();
int item = 2;
int max = int.MaxValue / 2;
while ((item = 2 * item) < max)
{
twos.Add(item.ToString());
}
ComboBox comboBox1 = new ComboBox();
comboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
comboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
comboBox1.FormattingEnabled = true;
//comboBox1.Items.Clear();
comboBox1.Items.AddRange(twos.ToArray());
comboBox1.AutoCompleteCustomSource.AddRange(twos.ToArray());
this.Controls.Add(comboBox1);
You should inherit the UpDownBase
class.
You're going to run into a problem in 2+ digit numbers. If I want to put 32
and you see the 3
as I am typing, then your program would just tell me I'm wrong. Validate it when you submit your data.