Example #1
0
        public void AddCheckBox(string name, int id, bool check)
        {
            CheckBox cb = new CheckBox();
            int y0 = constSpace;

            foreach (Control c in Controls)
            {
                if (c is TextBox) continue;
                else y0 += c.Size.Height + constSpace;
            }

            cb.Location =  Point(constSpace, y0);
            cb.Size = CHECKBOX_SIZE;
            cb.AutoSize = true;
            cb.Name = name;
            cb.Text = name + ":";
            cb.Checked = check;
            cb.CheckedChanged += new EventHandler(checkBox_CheckedChanged);
            Param p = new Param();
            p.i = check ? 1 : 0;
            p.id = id;
            eventArgs.Add(name, p);
            this.Controls.Add(cb);
            y0 += cb.Size.Height + constSpace;

            CalcControlSize();
        }
Example #2
0
        public void AddComboBox(string name, int id, string[] values)
        {
            Label l = new Label();
            ComboBox cBox = new ComboBox();
            int y0 = constSpace;

            foreach (Control c in Controls)
            {
                if (c is TextBox) continue;
                else y0 += c.Size.Height + constSpace;
            }

            l.Location =  Point(constSpace, y0);
            l.Size = LABEL_SIZE;
            l.AutoSize = true;
            l.Text = name + ":";
            this.Controls.Add(l);
            y0 += l.Size.Height + constSpace;

            cBox.FormattingEnabled = true;
            cBox.Items.AddRange(values);
            cBox.Name = name;
            cBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged);
            cBox.SelectedIndex = 0;
            cBox.Location = Point(constSpace, y0);
            cBox.Size = COMBOBOX_SIZE;
            this.Controls.Add(cBox);
            Param p = new Param();
            p.s = cBox.SelectedItem.ToString();
            p.id = id;
            eventArgs.Add(name, p);

            CalcControlSize();
        }
Example #3
0
        public void AddTrackbar(string name, int id, int min, int max, int tf, int startValue)
        {
            TrackBar trackBar = new TrackBar();
            Label l = new Label();
            TextBox tb = new TextBox();
            int y0 = constSpace;

            foreach (Control c in Controls)
            {
                if (c is TextBox) continue;
                else y0 += c.Size.Height + constSpace;
            }

            l.Location =  Point(constSpace, y0);
            l.Size = LABEL_SIZE;
            l.AutoSize = true;
            l.Text = name + ":";
            this.Controls.Add(l);
            y0 += l.Size.Height + constSpace;

            trackBar.Name = name;
            trackBar.Minimum = min;
            trackBar.Maximum = max;
            trackBar.TickFrequency = tf;
            trackBar.Value = startValue;
            trackBar.BackColor = Color.Yellow;
            trackBar.Scroll += new EventHandler(trackBar_Scroll);
            Param p = new Param();
            p.i = startValue;
            p.id = id;
            eventArgs.Add(name, p);
            trackBar.Location =  Point(constSpace, y0);
            trackBar.Size = TRACKBAR_SIZE;
            this.Controls.Add(trackBar);

            tb.Location = Point(trackBar.Size.Width + 2 * constSpace, y0 + 15);
            tb.Size = Size(40, tb.Size.Height);
            tb.Text = startValue.ToString();
            tb.Name = name;
            this.Controls.Add(tb);

            CalcControlSize();
        }