private void loadForm()
        {
            query = "select FormID from forms where Path=\"" + Path.GetFileName(loadedPdf) + "\" and Hardcoded=0";
            String formID = database.SelectString(query);
            query = "select * from CustomForms where FormID=" + formID;
            form = database.GetTable(query);

            String[] bigDelimit = new String[] { "-&" };
            String[] delimits = new String[] { "-;" };

            // Labels
            String temp = form.Rows[0]["Labels"].ToString();
            String[] results = temp.Split(bigDelimit, StringSplitOptions.None);
            foreach (String s in results)
            {
                if (s != "")
                {
                    String[] subResults = s.Split(delimits, StringSplitOptions.None);
                    EditableLabel newLabel = new EditableLabel();
                    newLabel.Name = subResults[0];
                    newLabel.Text = subResults[1];
                    newLabel.Draggable(true);
                    Controls.Add(newLabel);
                    newLabel.Location = new Point(Convert.ToInt32(subResults[2]), Convert.ToInt32(subResults[3]));
                }
            }

            // Textboxes
            temp = form.Rows[0]["Textboxes"].ToString();
            results = temp.Split(bigDelimit, StringSplitOptions.None);
            foreach (String s in results)
            {
                if (s != "")
                {
                    String[] subResults = s.Split(delimits, StringSplitOptions.None);
                    CustomTextboxLabel newTextbox = new CustomTextboxLabel();
                    newTextbox.pdfAttribute = subResults[0];
                    newTextbox.Name = subResults[0];
                    newTextbox.label.Text = subResults[1];
                    if (subResults[2].Equals("True"))
                    {
                        newTextbox.textBox.Multiline = true;
                        newTextbox.Height = 78;
                    }
                    newTextbox.Draggable(true);
                    Controls.Add(newTextbox);
                    newTextbox.Width = newTextbox.label.Width + newTextbox.textBox.Width;
                    newTextbox.Location = new Point(Convert.ToInt32(subResults[3]), Convert.ToInt32(subResults[4]));
                }
            }

            // Comboboxes
            temp = form.Rows[0]["Comboboxes"].ToString();
            results = temp.Split(bigDelimit, StringSplitOptions.None);
            foreach (String s in results)
            {
                if (s != "")
                {
                    String[] subResults = s.Split(delimits, StringSplitOptions.None);
                    EditableCombobox newCombobox = new EditableCombobox();
                    newCombobox.pdfAttribute = subResults[0];
                    newCombobox.Name = subResults[0];
                    newCombobox.rememberName = subResults[0];

                    foreach (String line in subResults[3].Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None))
                    {
                        newCombobox.combobox.Items.Add(line);
                    }
                    if (newCombobox.combobox.Items.Count > 0)
                        newCombobox.combobox.SelectedIndex = 0;
                    newCombobox.Draggable(true);
                    Controls.Add(newCombobox);
                    newCombobox.resizeBox();
                    newCombobox.Location = new Point(Convert.ToInt32(subResults[1]), Convert.ToInt32(subResults[2]));
                }
            }

            // Checkboxes
            temp = form.Rows[0]["Checkboxes"].ToString();
            results = temp.Split(bigDelimit, StringSplitOptions.None);
            foreach (String s in results)
            {
                if (s != "")
                {
                    String[] subResults = s.Split(delimits, StringSplitOptions.None);
                    EditableCheckbox newCheckbox = new EditableCheckbox();
                    newCheckbox.pdfAttribute = subResults[0];
                    newCheckbox.Name = subResults[0];
                    newCheckbox.checkbox.Text = subResults[1];
                    newCheckbox.Draggable(true);
                    Controls.Add(newCheckbox);
                    newCheckbox.Location = new Point(Convert.ToInt32(subResults[2]), Convert.ToInt32(subResults[3]));
                }
            }

            query = "select FormName, Panel from forms where FormID=" + formID;
            form = database.GetTable(query);

            IMPORTANTYESTitleBox.Text = form.Rows[0]["FormName"].ToString();
            IMPORTANTYESPanelChoiceBox.SelectedIndex = panelIndex;
        }
 private void rightClick(object sender, MouseEventArgs e)
 {
     if (!locked && e.Button == MouseButtons.Right)
     {
         using (FormEditor_ChangeType form = new FormEditor_ChangeType())
         {
             form.StartPosition = FormStartPosition.Manual;
             form.Location = new System.Drawing.Point(Cursor.Position.X, Cursor.Position.Y);
             form.ShowDialog();
             if (form.DialogResult == DialogResult.Yes)
             {
                 switch (form.result)
                 {
                     case "Textbox":
                         CustomTextboxLabel textBox = new CustomTextboxLabel();
                         textBox.textBox.Multiline = false;
                         textBox.pdfAttribute = this.pdfAttribute;
                         textBox.label.Text = checkbox.Text;
                         textBox.Size = new System.Drawing.Size(textBox.Width, 22);
                         textBox.resetSize();
                         textBox.Draggable(true);
                         Parent.Controls.Add(textBox);
                         textBox.Location = this.Location;
                         textBox.Width = textBox.label.Width + textBox.textBox.Width;
                         Parent.Controls.Remove(this);
                         break;
                     case "BigTextbox":
                         CustomTextboxLabel multitextBox = new CustomTextboxLabel();
                         multitextBox.textBox.Multiline = true;
                         multitextBox.pdfAttribute = this.pdfAttribute;
                         multitextBox.label.Text = checkbox.Text;
                         multitextBox.Height = 78;
                         multitextBox.Size = new System.Drawing.Size(multitextBox.textBox.Width, 78);
                         multitextBox.Draggable(true);
                         Parent.Controls.Add(multitextBox);
                         multitextBox.Location = this.Location;
                         multitextBox.Width = multitextBox.label.Width + multitextBox.textBox.Width;
                         Parent.Controls.Remove(this);
                         break;
                     case "Combobox":
                         EditableCombobox combobox = new EditableCombobox();
                         combobox.Text = checkbox.Text;
                         combobox.Parent = this.Parent;
                         combobox.pdfAttribute = this.pdfAttribute;
                         combobox.Draggable(true);
                         combobox.rememberName = checkbox.Text;
                         combobox.combobox.Items.Add(checkbox.Text);
                         combobox.combobox.SelectedIndex = 0;
                         Parent.Controls.Add(combobox);
                         combobox.Location = this.Location;
                         Parent.Controls.Remove(this);
                         break;
                     case "Checkbox":
                         break;
                     default:
                         break;
                 }
             }
         }
     }
 }