Exemple #1
0
        private void Form1_MouseWheel(object sender, MouseEventArgs e)
        {
            int increase = e.Delta / 120;

            if (increase != 0)
            {
                if (current.Name == "grpItemType")
                {
                    int oldIndex = current.Controls.IndexOfKey("radItemType" + current.GetChecked().ToString());
                    int newIndex = Math.Max(0, Math.Min(4, oldIndex - increase));
                    if (newIndex != oldIndex)
                    {
                        ((RadioButton)current.Controls[newIndex]).Checked = true;
                    }
                }
                else
                {
                    var controls = current.Controls.OfType <RadioButton>().OrderBy(c => c.GetControlIndex()).ToList();
                    int oldIndex = controls.FindIndex(r => r.Checked);
                    int newIndex = Math.Max(0, Math.Min(controls.Count - 1, current.Name.Contains("AnteTier") || current.Name.Contains("Rarity") ? oldIndex - increase : oldIndex + increase));
                    if (newIndex != oldIndex)
                    {
                        controls[newIndex].Checked = true;
                    }
                }
            }
        }