private void btnSubmit_Click(object sender, System.EventArgs e) { this.Replacements = new StringDictionary(); foreach (Control ctrl in this.pnlReplacements.Controls) { if (ctrl is UtilityReplacementUnit) { UtilityReplacementUnit unit = (UtilityReplacementUnit)ctrl; this.Replacements.Add(unit.Key, unit.Value); } } if (this.chkInsert.Checked) { this.Replacements.Add("<<INSERT>>", this.rtbSqlScript.Text); } else { this.Replacements.Add("<<INSERT>>", ""); } this.DialogResult = DialogResult.OK; this.Close(); }
private void UtilityReplacement_Load(object sender, System.EventArgs e) { //F1 int value = 112 int functionKey = 112; for (int i = 0; i < this.keyValues.Length; i++) { if (this.keyValues[i].ToUpper() != "<<INSERT>>") { UtilityReplacementUnit unit = new UtilityReplacementUnit(this.keyValues[i], (Keys)functionKey); unit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); unit.Size = startSize; functionKey++; unit.Location = startLocation; this.pnlReplacements.Controls.Add(unit); if (i > 0) { this.Height += unit.Height; this.pnlReplacements.Height += unit.Height; } startLocation = new Point(startLocation.X, startLocation.Y + unit.Height); } else { chkInsert.Checked = true; chkInsert.Enabled = true; } } if (this.inputText.Length == 0) { IDataObject ido = Clipboard.GetDataObject(); this.rtbSqlScript.Text = (string)ido.GetData(DataFormats.Text); } else { this.rtbSqlScript.Text = this.inputText; this.chkClipBoard.Checked = false; } }