示例#1
0
        /// <summary>
        /// common click event for all APC buttons
        /// </summary>
        private void APCButton_Click(object sender, EventArgs e)
        {
            Button       btn = (Button)sender;
            APCLEDButton led = (APCLEDButton)btn.Tag;

            int index;

            if (((MouseEventArgs)e).Button == MouseButtons.Right || led.SelectedOptionIndex == (led.AvailableOptions.Count - 1))
            {
                index = -1;
            }
            else
            {
                if (led.SelectedOptionIndex == -1)
                {
                    index = 0;
                }
                else
                {
                    index = led.SelectedOptionIndex + 1;
                }
            }

            led.SetSelectedOption(index);
        }
示例#2
0
        /// <summary>
        /// common right-click event for all APC buttons
        /// </summary>
        private void APCButton_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Button       btn = (Button)sender;
                APCLEDButton led = (APCLEDButton)btn.Tag;

                btn.BackColor = SystemColors.Control;
                btn.Text      = "";
                led.SetSelectedOption(-1);
                TurnOffLED(led.Channel, led.NoteNumber);
            }
        }