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 DoubleClick(object sender, MouseEventArgs e) { Point loc = e.Location; EditableLabel newLabel = new EditableLabel(); newLabel.triggerEntry(sender, e); if (!newLabel.Text.Equals(String.Empty)) Controls.Add(newLabel); newLabel.Location = loc; }
private void grabForm(object sender, EventArgs e) { newFile = Convert.ToString(rng.Next(int.MaxValue)) + ".pdf"; query = "select * from ClientInfo where ClientID=" + client; clientInfo = database.GetTable(query); query = "select Path from forms where FormID=" + loadFormID; templatePDF += database.SelectString(query); if (!File.Exists(templatePDF)) { MessageBox.Show("There was an error finding " + form.Rows[0]["Path"].ToString() + "!"); this.Close(); } query = "select * from CustomForms where FormID=" + loadFormID; 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.locked = true; newLabel.Draggable(false); 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.locked = true; newTextbox.label.Text = subResults[1]; if (subResults[2].Equals("True")) { newTextbox.textBox.Multiline = true; newTextbox.Height = 78; } newTextbox.Draggable(false); 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); ComboBoxer newCombobox = new ComboBoxer(); newCombobox.pdfAttribute = subResults[0]; newCombobox.Name = subResults[0]; newCombobox.DropDownStyle = ComboBoxStyle.DropDownList; foreach (String line in subResults[3].Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None)) { newCombobox.Items.Add(line); } if (newCombobox.Items.Count > 0) newCombobox.SelectedIndex = 0; newCombobox.Draggable(false); 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); CheckBoxer newCheckbox = new CheckBoxer(); newCheckbox.pdfAttribute = subResults[0]; newCheckbox.Name = subResults[0]; newCheckbox.Text = subResults[1]; newCheckbox.Draggable(false); Controls.Add(newCheckbox); newCheckbox.Location = new Point(Convert.ToInt32(subResults[2]), Convert.ToInt32(subResults[3])); } } query = "select FormName, Panel from forms where FormID=" + loadFormID; form = database.GetTable(query); IMPORTANTYESTitleBox.Text = form.Rows[0]["FormName"].ToString(); this.Text = IMPORTANTYESTitleBox.Text; }