-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInputBox.cs
129 lines (118 loc) · 4.18 KB
/
InputBox.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace HttpConfig
{
public class InputBox : System.Windows.Forms.Form
{
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox userInputTextBox;
private System.Windows.Forms.Label promptLabel;
private System.ComponentModel.Container components = null;
public InputBox()
{
InitializeComponent();
}
public InputBox(string caption, string prompt) : this()
{
Text = caption;
promptLabel.Text = prompt;
}
public string Caption
{
get { return Text; }
set { Text = value; }
}
public string Prompt
{
get { return promptLabel.Text; }
set { promptLabel.Text = value; }
}
public string UserInput
{
get { return userInputTextBox.Text; }
set { userInputTextBox.Text = value; }
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.userInputTextBox = new System.Windows.Forms.TextBox();
this.promptLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(56, 64);
this.okButton.Name = "okButton";
this.okButton.TabIndex = 0;
this.okButton.Text = "&OK";
//
// cancelButton
//
this.cancelButton.CausesValidation = false;
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(136, 64);
this.cancelButton.Name = "cancelButton";
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "&Cancel";
//
// userInputTextBox
//
this.userInputTextBox.Location = new System.Drawing.Point(8, 32);
this.userInputTextBox.Name = "userInputTextBox";
this.userInputTextBox.Size = new System.Drawing.Size(248, 20);
this.userInputTextBox.TabIndex = 2;
this.userInputTextBox.Text = "";
//
// promptLabel
//
this.promptLabel.Location = new System.Drawing.Point(8, 8);
this.promptLabel.Name = "promptLabel";
this.promptLabel.Size = new System.Drawing.Size(240, 16);
this.promptLabel.TabIndex = 3;
this.promptLabel.Text = "Prompt";
//
// InputBox
//
this.AcceptButton = this.okButton;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(266, 104);
this.ControlBox = false;
this.Controls.Add(this.promptLabel);
this.Controls.Add(this.userInputTextBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InputBox";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "InputBox";
this.Activated += new System.EventHandler(this.InputBox_Activated);
this.ResumeLayout(false);
}
#endregion
private void InputBox_Activated(object sender, System.EventArgs e)
{
userInputTextBox.Focus();
}
}
}