-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfrmPrompt.cs
More file actions
127 lines (120 loc) · 5.26 KB
/
frmPrompt.cs
File metadata and controls
127 lines (120 loc) · 5.26 KB
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
namespace Standard
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class frmPrompt : Form
{
private Button btnCancel;
private Button btnOk;
private Container components;
private PictureBox pbImage;
internal TextBox txtInput;
internal RichTextBox txtMessage;
private frmPrompt()
{
this.InitializeComponent();
}
protected void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
//[CodeDescription("Get a string value from the user.")]
public static string GetUserString(string sTitle, string sPrompt, string sDefault)
{
return GetUserString(sTitle, sPrompt, sDefault, false);
}
//[CodeDescription("Get a string value from the user.")]
public static string GetUserString(string sTitle, string sPrompt, string sDefault, bool bReturnNullIfCancelled)
{
frmPrompt prompt = new frmPrompt();
prompt.StartPosition = FormStartPosition.CenterScreen;
prompt.Text = sTitle;
prompt.txtMessage.Text = sPrompt;
prompt.txtInput.Text = sDefault;
DialogResult result = prompt.ShowDialog();
if (DialogResult.OK == result)
{
sDefault = prompt.txtInput.Text;
}
prompt.Dispose();
if (bReturnNullIfCancelled && (DialogResult.OK != result))
{
return null;
}
return sDefault;
}
private void InitializeComponent()
{
ComponentResourceManager manager = new ComponentResourceManager(typeof(frmPrompt));
this.btnCancel = new Button();
this.txtMessage = new RichTextBox();
this.btnOk = new Button();
this.pbImage = new PictureBox();
this.txtInput = new TextBox();
((ISupportInitialize) this.pbImage).BeginInit();
base.SuspendLayout();
this.btnCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.btnCancel.DialogResult = DialogResult.No;
this.btnCancel.Location = new Point(0x12d, 0x58);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new Size(0x4b, 0x17);
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "&Cancel";
this.txtMessage.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.txtMessage.BackColor = SystemColors.Control;
this.txtMessage.BorderStyle = BorderStyle.None;
this.txtMessage.Location = new Point(0x30, 11);
this.txtMessage.Name = "txtMessage";
this.txtMessage.ReadOnly = true;
this.txtMessage.Size = new Size(0x150, 0x25);
this.txtMessage.TabIndex = 3;
this.txtMessage.Text = "Codito Ergo Sum Codito Ergo Sum Codito Ergo Sum ";
this.btnOk.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.btnOk.DialogResult = DialogResult.OK;
this.btnOk.Location = new Point(220, 0x58);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new Size(0x4b, 0x17);
this.btnOk.TabIndex = 1;
this.btnOk.Text = "OK";
// this.pbImage.Image = (Image) manager.GetObject("pbImage.Image");
this.pbImage.Location = new Point(8, 8);
this.pbImage.Name = "pbImage";
this.pbImage.Size = new Size(0x20, 0x20);
this.pbImage.SizeMode = PictureBoxSizeMode.CenterImage;
this.pbImage.TabIndex = 7;
this.pbImage.TabStop = false;
this.txtInput.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
this.txtInput.Location = new Point(0x30, 0x38);
this.txtInput.Name = "txtInput";
this.txtInput.Size = new Size(0x148, 0x15);
this.txtInput.TabIndex = 0;
base.AcceptButton = this.btnOk;
this.AutoScaleBaseSize = new Size(5, 14);
base.CancelButton = this.btnCancel;
base.ClientSize = new Size(0x188, 120);
base.Controls.Add(this.txtInput);
base.Controls.Add(this.btnCancel);
base.Controls.Add(this.txtMessage);
base.Controls.Add(this.btnOk);
base.Controls.Add(this.pbImage);
this.Font = new Font("Tahoma", 8.25f);
base.FormBorderStyle = FormBorderStyle.SizableToolWindow;
// base.Icon = (Icon) manager.GetObject("$this.Icon");
base.MinimizeBox = false;
this.MinimumSize = new Size(200, 100);
base.Name = "frmPrompt";
base.SizeGripStyle = SizeGripStyle.Hide;
base.StartPosition = FormStartPosition.Manual;
this.Text = " Prompt";
((ISupportInitialize) this.pbImage).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
}
}