상속: System.Windows.Forms.ProgressBar
        void doButtontoUI(string name, int x, int y)
        {
            MyLabel butlabel = new MyLabel();
            ComboBox butnumberlist = new ComboBox();
            Controls.MyButton but_detect = new Controls.MyButton();
            HorizontalProgressBar hbar = new HorizontalProgressBar();
            ComboBox cmbaction = new ComboBox();
            Controls.MyButton but_settings = new Controls.MyButton();

            var config = Joystick.self.getButton(int.Parse(name));

            // do this here so putting in text works
            this.Controls.AddRange(new Control[] { butlabel, butnumberlist, but_detect, hbar, cmbaction, but_settings });

            butlabel.Location = new Point(x, y);
            butlabel.Size = new Size(47, 13);
            butlabel.Text = "Button " + (int.Parse(name)  +1);

            butnumberlist.Location = new Point(72, y);
            butnumberlist.Size = new Size(70, 21);
            butnumberlist.DataSource = getButtonNumbers();
            butnumberlist.DropDownStyle = ComboBoxStyle.DropDownList;
            butnumberlist.Name = "cmbbutton" + name;
            //if (MainV2.config["butno" + name] != null)
              //  butnumberlist.Text = (MainV2.config["butno" + name].ToString());
            //if (config.buttonno != -1)
                butnumberlist.Text = config.buttonno.ToString();
            butnumberlist.SelectedIndexChanged += new EventHandler(cmbbutton_SelectedIndexChanged);

            but_detect.Location = new Point(BUT_detch1.Left, y);
            but_detect.Size = BUT_detch1.Size;
            but_detect.Text = BUT_detch1.Text;
            but_detect.Name = "mybut" + name;
            but_detect.Click += new EventHandler(BUT_detbutton_Click);

            hbar.Location = new Point(progressBarRoll.Left, y);
            hbar.Size = progressBarRoll.Size;
            hbar.Name = "hbar" + name;

            cmbaction.Location = new Point(hbar.Right + 5, y);
            cmbaction.Size = new Size(100, 21);

            cmbaction.DataSource = Enum.GetNames(typeof(Joystick.buttonfunction)); //Common.getModesList(MainV2.comPort.MAV.cs);
            //cmbaction.ValueMember = "Key";
            //cmbaction.DisplayMember = "Value";
            cmbaction.Tag = name;
            cmbaction.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbaction.Name = "cmbaction" + name;
            //if (MainV2.config["butaction" + name] != null)
              //  cmbaction.Text = MainV2.config["butaction" + name].ToString();
            //if (config.function != Joystick.buttonfunction.ChangeMode)
                cmbaction.Text = config.function.ToString();
            cmbaction.SelectedIndexChanged += cmbaction_SelectedIndexChanged;

            but_settings.Location = new Point(cmbaction.Right + 5, y);
            but_settings.Size = BUT_detch1.Size;
            but_settings.Text = "Settings";
            but_settings.Name = "butsettings" + name;
            but_settings.Click += but_settings_Click;
            but_settings.Tag = cmbaction;

            if ((but_settings.Bottom + 30) > this.Height)
                this.Height += 25;
        }
예제 #2
0
        void doButtontoUI(string name, int x, int y)
        {
            MyLabel lbl = new MyLabel();
            ComboBox cmbbutton = new ComboBox();
            Controls.MyButton mybut = new Controls.MyButton();
            HorizontalProgressBar hbar = new HorizontalProgressBar();
            ComboBox cmbaction = new ComboBox();

            // do this here so putting in text works
            this.Controls.AddRange(new Control[] { lbl, cmbbutton, mybut, hbar, cmbaction });

            lbl.Location = new Point(x, y);
            lbl.Size = new Size(47, 13);
            lbl.Text = "Button " + name;

            cmbbutton.Location = new Point(72, y);
            cmbbutton.Size = new Size(70, 21);
            cmbbutton.DataSource = getButtonNumbers();
            cmbbutton.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbbutton.Name = "cmbbutton" + name;
            if (MainV2.config["butno" + name] != null)
                cmbbutton.Text = (MainV2.config["butno" + name].ToString());
            cmbbutton.SelectedIndexChanged += new EventHandler(cmbbutton_SelectedIndexChanged);

            mybut.Location = new Point(BUT_detch1.Left, y);
            mybut.Size = BUT_detch1.Size;
            mybut.Text = BUT_detch1.Text;
            mybut.Name = "mybut" + name;
            mybut.Click += new EventHandler(BUT_detbutton_Click);

            hbar.Location = new Point(progressBar1.Left, y);
            hbar.Size = progressBar1.Size;
            hbar.Name = "hbar" + name;

            cmbaction.Location = new Point(hbar.Right + 5, y);
            cmbaction.Size = new Size(100, 21);

            cmbaction.DataSource = Common.getModesList(MainV2.comPort.MAV.cs);
            cmbaction.ValueMember = "Key";
            cmbaction.DisplayMember = "Value";

            cmbaction.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbaction.Name = "cmbaction" + name;
            if (MainV2.config["butaction" + name] != null)
                cmbaction.Text = MainV2.config["butaction" + name].ToString();

            this.Height += 25;
        }