Пример #1
0
        void button_ValueChanged(object sender, EventArgs e)
        {
            TrackButton tb = sender as TrackButton;

            if (!editMode)
            {
                ControlMap map = (ControlMap)((UserControl)sender).Tag;

                map.DispatchMessage(MIDI.MidiMessage.NoteOn, -1, 0, tb.Value);
            }
        }
Пример #2
0
        private void AddButton(ControlMap map)
        {
            switch (map.ButtonType)
            {
            case ButtonType.Button:
            {
                WwtButton button = new WwtButton();
                map.Width         = 140;
                map.Height        = 33;
                button.Text       = map.Name;
                button.Location   = new Point((int)map.X, (int)map.Y);
                button.Click     += new EventHandler(button_Click);
                button.MouseDown += new MouseEventHandler(button_MouseDown);
                button.MouseMove += new MouseEventHandler(button_MouseMove);
                button.MouseUp   += new MouseEventHandler(button_MouseUp);
                button.Tag        = map;

                Controls.Add(button);
            }
            break;

            case ButtonType.Checkbox:
            {
                WWTCheckbox button = new WWTCheckbox();
                map.Width  = 140;
                map.Height = 33;
                //button.Parent = this;
                button.Text            = map.Name;
                button.Location        = new Point((int)map.X, (int)map.Y);
                button.CheckedChanged += new EventHandler(button_CheckedChanged);
                button.MouseDown      += new MouseEventHandler(button_MouseDown);
                button.MouseMove      += new MouseEventHandler(button_MouseMove);
                button.MouseUp        += new MouseEventHandler(button_MouseUp);
                button.Tag             = map;

                Controls.Add(button);
            }
            break;

            case ButtonType.Slider:
            {
                TrackButton button = new TrackButton();
                map.Width  = 140;
                map.Height = 33;
                //button.Parent = this;
                button.LabelText     = map.Name;
                button.Location      = new Point((int)map.X, (int)map.Y);
                button.ValueChanged += new EventHandler(button_ValueChanged);
                button.MouseDown    += new MouseEventHandler(button_MouseDown);
                button.MouseMove    += new MouseEventHandler(button_MouseMove);
                button.MouseUp      += new MouseEventHandler(button_MouseUp);
                button.Tag           = map;
                button.Value         = (int)map.GetValue(MIDI.MidiMessage.NoteOn, -1, 0);
                Controls.Add(button);
            }
            break;

            default:
                break;
            }

            EnableUserChildren(!editMode);
        }
        private void AddButton(ControlMap map)
        {
            switch (map.ButtonType)
            {
                case ButtonType.Button:
                    {
                        WwtButton button = new WwtButton();
                        map.Width = 140;
                        map.Height = 33;
                        button.Text = map.Name;
                        button.Location = new Point((int)map.X, (int)map.Y);
                        button.Click += new EventHandler(button_Click);
                        button.MouseDown += new MouseEventHandler(button_MouseDown);
                        button.MouseMove += new MouseEventHandler(button_MouseMove);
                        button.MouseUp += new MouseEventHandler(button_MouseUp);
                        button.Tag = map;

                        Controls.Add(button);
                    }
                    break;
                case ButtonType.Checkbox:
                    {
                        WWTCheckbox button = new WWTCheckbox();
                        map.Width = 140;
                        map.Height = 33;
                        //button.Parent = this;
                        button.Text = map.Name;
                        button.Location = new Point((int)map.X, (int)map.Y);
                        button.CheckedChanged += new EventHandler(button_CheckedChanged);
                        button.MouseDown += new MouseEventHandler(button_MouseDown);
                        button.MouseMove += new MouseEventHandler(button_MouseMove);
                        button.MouseUp += new MouseEventHandler(button_MouseUp);
                        button.Tag = map;

                        Controls.Add(button);
                    }
                    break;
                case ButtonType.Slider:
                    {
                        TrackButton button = new TrackButton();
                        map.Width = 140;
                        map.Height = 33;
                        //button.Parent = this;
                        button.LabelText = map.Name;
                        button.Location = new Point((int)map.X, (int)map.Y);
                        button.ValueChanged += new EventHandler(button_ValueChanged);
                        button.MouseDown += new MouseEventHandler(button_MouseDown);
                        button.MouseMove += new MouseEventHandler(button_MouseMove);
                        button.MouseUp += new MouseEventHandler(button_MouseUp);
                        button.Tag = map;
                        button.Value = (int)map.GetValue(MIDI.MidiMessage.NoteOn, -1, 0);
                        Controls.Add(button);
                    }
                    break;
                default:
                    break;
            }

            EnableUserChildren(!editMode);
        }