/////////////////////// http://www.csharp-examples.net/inputbox/ ////////////////////// public static DialogResult InputBox(string title, string promptText, ref string value) { Office2007Form form = new Office2007Form(); LabelX label = new LabelX(); DevComponents.DotNetBar.Controls.TextBoxX textBox = new DevComponents.DotNetBar.Controls.TextBoxX(); ButtonX buttonOk = new ButtonX(); ButtonX buttonCancel = new ButtonX(); form.Text = title; label.Text = promptText; textBox.Text = value; textBox.Border.Class = "TextBoxBorder"; textBox.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; textBox.Location = new System.Drawing.Point(240, 151); textBox.Name = "textbox"; textBox.ReadOnly = false; textBox.Size = new System.Drawing.Size(275, 20); textBox.TabIndex = 1; buttonOk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; buttonOk.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; buttonCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; buttonCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; buttonOk.Text = "OK"; buttonCancel.Text = "Cancel"; buttonOk.DialogResult = DialogResult.OK; buttonCancel.DialogResult = DialogResult.Cancel; label.SetBounds(9, 20, 372, 13); textBox.SetBounds(12, 36, 372, 20); buttonOk.SetBounds(228, 72, 75, 23); buttonCancel.SetBounds(309, 72, 75, 23); label.AutoSize = true; textBox.Anchor = textBox.Anchor | AnchorStyles.Right; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; form.ClientSize = new Size(396, 107); form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel }); form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; form.AcceptButton = buttonOk; form.CancelButton = buttonCancel; form.EnableGlass = false; DialogResult dialogResult = form.ShowDialog(); value = textBox.Text; return(dialogResult); }
private void btnSetBaseData_Click(object sender, EventArgs e) { Office2007Form editBaseData = new Office2007Form(); editBaseData.EnableGlass = false; editBaseData.Icon = Resources.iconLarge; editBaseData.Text = "Stammdaten bearbeiten"; editBaseData.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; editBaseData.ControlBox = false; editBaseData.AutoSize = true; editBaseData.Controls.Add(new EditorBaseData()); if (editBaseData.ShowDialog() == System.Windows.Forms.DialogResult.OK) { loadBaseData(); } this.BringToFront(); }
private void btnSetSettings_Click(object sender, EventArgs e) { Office2007Form editBaseData = new Office2007Form(); editBaseData.EnableGlass = false; editBaseData.Icon = Resources.iconLarge; editBaseData.Text = "Einstellungen bearbeiten"; editBaseData.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; editBaseData.ControlBox = false; editBaseData.AutoSize = true; editBaseData.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; EditorSettings edit = new EditorSettings(); edit.cbxSelectReporttype.Enabled = false; editBaseData.Controls.Add(edit); if (editBaseData.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _settings = DataManager.LoadSettings(); } this.BringToFront(); }
/////////////////////// http://www.csharp-examples.net/inputbox/ ////////////////////// public static DialogResult InputBox(string title, string promptText, ref string value) { Office2007Form form = new Office2007Form(); LabelX label = new LabelX(); DevComponents.DotNetBar.Controls.TextBoxX textBox = new DevComponents.DotNetBar.Controls.TextBoxX(); ButtonX buttonOk = new ButtonX(); ButtonX buttonCancel = new ButtonX(); form.Text = title; label.Text = promptText; textBox.Text = value; textBox.Border.Class = "TextBoxBorder"; textBox.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; textBox.Location = new System.Drawing.Point(240, 151); textBox.Name = "textbox"; textBox.ReadOnly = false; textBox.Size = new System.Drawing.Size(275, 20); textBox.TabIndex = 1; buttonOk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; buttonOk.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; buttonCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; buttonCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; buttonOk.Text = "OK"; buttonCancel.Text = "Cancel"; buttonOk.DialogResult = DialogResult.OK; buttonCancel.DialogResult = DialogResult.Cancel; label.SetBounds(9, 20, 372, 13); textBox.SetBounds(12, 36, 372, 20); buttonOk.SetBounds(228, 72, 75, 23); buttonCancel.SetBounds(309, 72, 75, 23); label.AutoSize = true; textBox.Anchor = textBox.Anchor | AnchorStyles.Right; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; form.ClientSize = new Size(396, 107); form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel }); form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; form.AcceptButton = buttonOk; form.CancelButton = buttonCancel; form.EnableGlass = false; DialogResult dialogResult = form.ShowDialog(); value = textBox.Text; return dialogResult; }