Ejemplo n.º 1
0
            private Control CreateControlFor(SpriteDataField v)
            {
//                Console.WriteLine(v.display + " " + v.name);
                if (v.display == "checkbox")
                {
                    CheckBox c = new CheckBox();
                    c.Checked         = v.getValue(s.Data) == 1;
                    c.Text            = v.name;
                    c.CheckedChanged += new EventHandler(saveData);
                    return(c);
                }
                else if (v.display == "list")
                {
                    ComboBox c = new ComboBox();
                    c.DropDownStyle = ComboBoxStyle.DropDownList;
                    c.Items.AddRange(v.strings);
                    try
                    {
                        c.SelectedIndex = Array.IndexOf(v.values, v.getValue(s.Data));
                    }
                    catch (ArgumentOutOfRangeException) { } //just in case
                    //c.SelectedIndexChanged += new EventHandler(saveData);
                    c.SelectionChangeCommitted += new EventHandler(saveData);
                    //c.DropDownClosed += new EventHandler(saveData);

                    return(c);
                }
                else if (v.display == "label")
                {
                    Label c = new Label();
                    c.Text = v.name;
                    return(c);
                }
                else if (v.display == "binary")
                {
                    BinaryEdit c = new BinaryEdit();
                    c.CheckBoxCount = v.getBitCount();
                    c.value         = v.getValue(s.Data);
                    c.ValueChanged += new EventHandler(saveData);
                    return(c);
                }
                else
                {
                    NumericUpDown c = new NumericUpDown();
                    c.Minimum       = v.getMin();
                    c.Maximum       = v.getMax();
                    c.Value         = v.getValue(s.Data);
                    c.ValueChanged += new EventHandler(saveData);
                    return(c);
                }
            }
Ejemplo n.º 2
0
            private Control CreateControlFor(SpriteDataField v)
            {
//                Console.WriteLine(v.display + " " + v.name);
                if (v.display == "checkbox")
                {
                    CheckBox c = new CheckBox();
                    c.Checked = v.getValue(s.Data) == 1;
                    c.Text = v.name;
                    c.CheckedChanged += new EventHandler(saveData);
                    return c;
                }
                else if (v.display == "list")
                {
                    ComboBox c = new ComboBox();
                    c.DropDownStyle = ComboBoxStyle.DropDownList;
                    c.Items.AddRange(v.strings);
                    try
                    {
                        c.SelectedIndex = Array.IndexOf(v.values, v.getValue(s.Data));
                    }
                    catch (ArgumentOutOfRangeException) { } //just in case
                    //c.SelectedIndexChanged += new EventHandler(saveData);
                    c.SelectionChangeCommitted += new EventHandler(saveData);
                    //c.DropDownClosed += new EventHandler(saveData);
                    
                    return c;
                }
                else if (v.display == "label")
                {
                    Label c = new Label();
                    c.Text = v.name;
                    return c;
                }
                else if (v.display == "binary")
                {
                    BinaryEdit c = new BinaryEdit();
                    c.CheckBoxCount = v.getBitCount();
                    c.value = v.getValue(s.Data);
                    c.ValueChanged += new EventHandler(saveData);
                    return c;
                }
                else
                {
                    NumericUpDown c = new NumericUpDown();
                    c.Minimum = v.getMin();
                    c.Maximum = v.getMax();
                    c.Value = v.getValue(s.Data);
                    c.ValueChanged += new EventHandler(saveData);
                    return c;
                }
            }