Ejemplo n.º 1
0
        private void createRadio(object sender, EventArgs e)
        {
            currentLayer = noOfLayers;
            currentLayer++;
            noOfLayers++;

            layers[currentLayer] = new RadioBoxPanel("Radio", currentLayer, "radio");
            DesignCanvas.Controls.Add(layers[currentLayer].getP());
        }
Ejemplo n.º 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (inputName.Text == "")
            {
                MessageBox.Show("Please Enter Name");
            }

            else
            {
                Panel p = new Panel();
                form.Visible = false;
                DesignCanvas.Controls.Add(p);
                p.Size       = new Size(350, 250);
                p.Location   = new Point(150, 80);
                p.BackColor  = Color.FromArgb(40, 40, 40);
                p.ForeColor  = Color.White;
                p.Font       = new Font("Microsoft Sans Serif", 11);
                p.AutoScroll = true;

                TextBox[] textInputs  = new TextBox[(int)choices.Value];
                TextBox[] valueInputs = new TextBox[(int)choices.Value];

                for (int i = 0; i < choices.Value; i++)
                {
                    int   y         = 18;
                    int   offset    = 10;
                    Label textLabel = new Label();
                    textLabel.Location = new Point(16, (i + 1) * (y + offset));
                    textLabel.AutoSize = true;
                    textLabel.Anchor   = AnchorStyles.Left;

                    TextBox text = new TextBox();
                    text.Location    = new Point(60, (i + 1) * (y + offset));
                    text.BorderStyle = BorderStyle.None;
                    text.BackColor   = Color.White;
                    text.ForeColor   = Color.Black;
                    text.ReadOnly    = false;
                    textInputs[i]    = text;


                    Label valueLabel = new Label();
                    valueLabel.Location = new Point(166, (i + 1) * (y + offset));
                    valueLabel.AutoSize = true;
                    valueLabel.Anchor   = AnchorStyles.Left;



                    TextBox value = new TextBox();
                    value.Location    = new Point(215, (i + 1) * (y + offset));
                    value.BorderStyle = BorderStyle.None;
                    value.BackColor   = Color.White;
                    value.ReadOnly    = false;
                    valueInputs[i]    = value;

                    textLabel.Text  = "Text #" + (i + 1) + ": ";
                    valueLabel.Text = "Value #" + (i + 1) + ": ";

                    p.Controls.Add(textLabel);
                    p.Controls.Add(text);
                    p.Controls.Add(valueLabel);
                    p.Controls.Add(value);
                }

                Button Ok     = new Button();
                Button Cancel = new Button();
                Ok.BackColor = Color.FromArgb(40, 40, 40);
                Ok.Text      = "OK";
                Ok.Location  = new Point(50, 200);
                Ok.Size      = new Size(116, 34);
                Ok.FlatStyle = FlatStyle.Flat;
                //Ok.Click += new EventHandler(createRadio);
                Ok.Click += (s, err) =>
                {
                    currentLayer = noOfLayers;
                    currentLayer++;
                    noOfLayers++;

                    if (radiobutton.Checked)
                    {
                        layers[currentLayer] = new RadioBoxPanel(inputName.Text, currentLayer, "radio");
                    }

                    if (check.Checked)
                    {
                        layers[currentLayer] = new RadioBoxPanel(inputName.Text, currentLayer, "checkbox");
                    }
                    DesignCanvas.Controls.Add(layers[currentLayer].getPanel());
                    p.Visible = false;
                    //  layers[currentLayer].setNoOfChoices((int)choices.Value);
                    for (int i = 0; i < textInputs.Length; i++)
                    {
                        layers[currentLayer].addChoice(valueInputs[i].Text);
                        // layers[currentLayer].getP().Controls.Add(layers[currentLayer].getChoice().getInputDesign());
                        layers[currentLayer].getChoice().getInputDesign().Text = textInputs[i].Text;
                        layers[currentLayer].getChoice().getInputDesign().Dock = DockStyle.Top;
                        layers[currentLayer].getChoice().getInputDesign().BringToFront();
                        layers[currentLayer].getChoice().getCode().getHTML().setValue(textInputs[i].Text);



                        if (radiobutton.Checked)
                        {
                            IndexedRadioButton temp = (IndexedRadioButton)layers[currentLayer].getChoice().getInputDesign();



                            temp.Click += (sr, er) =>
                            {
                                layers[currentLayer].setCurrentLi(temp.getIndex());
                                // layers[currentLayer].setCurrentLi(1);
                                // MessageBox.Show(layers[currentLayer].getChoice().getCode().getHTML().getValue());
                                RadioText.Text  = layers[currentLayer].getChoice().getCode().getHTML().getValue();
                                radioValue.Text = layers[currentLayer].getChoice().getCode().getHTML().getAttributeList().getAttributes()["value"];
                            };
                        }

                        if (check.Checked)
                        {
                            IndexedCheckBox temp = (IndexedCheckBox)layers[currentLayer].getChoice().getInputDesign();



                            temp.Click += (sr, er) =>
                            {
                                layers[currentLayer].setCurrentLi(temp.getIndex());
                                // layers[currentLayer].setCurrentLi(1);
                                // MessageBox.Show(layers[currentLayer].getChoice().getCode().getHTML().getValue());
                                RadioText.Text  = layers[currentLayer].getChoice().getCode().getHTML().getValue();
                                radioValue.Text = layers[currentLayer].getChoice().getCode().getHTML().getAttributeList().getAttributes()["value"];
                            };
                        }
                        HtmlCode.Text = writeCompleteHTML();
                    }
                };



                Cancel.BackColor = Color.FromArgb(40, 40, 40);
                Cancel.Text      = "Cancel";
                Cancel.Location  = new Point(180, 200);
                Cancel.Size      = new Size(116, 34);
                Cancel.FlatStyle = FlatStyle.Flat;

                Cancel.Click += (s, er) =>
                {
                    form.Visible = true;
                    p.Visible    = false;
                };


                p.Controls.Add(Ok);
                p.Controls.Add(Cancel);
            }
        }