2019-04-21 17:53:56 +00:00
|
|
|
using System;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
namespace RyzStudio.Windows.ThemedForms
|
|
|
|
{
|
2019-04-22 11:40:29 +00:00
|
|
|
public partial class TextBoxForm : System.Windows.Forms.Form
|
2019-04-21 17:53:56 +00:00
|
|
|
{
|
|
|
|
public TextBoxForm(string title, string labelText, string defaultValue)
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
|
2019-04-22 14:51:03 +00:00
|
|
|
textBox1.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
textBox1.InnerTextBox.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
|
2019-04-21 17:53:56 +00:00
|
|
|
this.Text = title;
|
|
|
|
label2.Text = labelText;
|
|
|
|
textBox1.Text = defaultValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
public TextBoxForm(string title, string labelText, string defaultValue, bool password)
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
|
2019-04-22 14:51:03 +00:00
|
|
|
textBox1.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
textBox1.InnerTextBox.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
|
2019-04-21 17:53:56 +00:00
|
|
|
this.Text = title;
|
|
|
|
label2.Text = labelText;
|
|
|
|
textBox1.Text = defaultValue;
|
|
|
|
textBox1.UseSystemPasswordChar = password;
|
2019-04-22 14:51:03 +00:00
|
|
|
|
2019-04-21 17:53:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public TextBoxForm(string title, string labelText)
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
|
2019-04-22 14:51:03 +00:00
|
|
|
textBox1.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
textBox1.InnerTextBox.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
|
2019-04-21 17:53:56 +00:00
|
|
|
this.Text = title;
|
|
|
|
label2.Text = labelText;
|
|
|
|
}
|
|
|
|
|
|
|
|
public TextBoxForm(string title, string labelText, bool password)
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
|
2019-04-22 14:51:03 +00:00
|
|
|
textBox1.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
textBox1.InnerTextBox.PreviewKeyDown += textBox1_PreviewKeyDown;
|
|
|
|
|
2019-04-21 17:53:56 +00:00
|
|
|
this.Text = title;
|
|
|
|
label2.Text = labelText;
|
|
|
|
textBox1.UseSystemPasswordChar = password;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
this.Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void textBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
|
|
|
{
|
|
|
|
switch (e.KeyCode)
|
|
|
|
{
|
|
|
|
case Keys.Escape:
|
|
|
|
this.Close();
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public new string ShowDialog()
|
|
|
|
{
|
|
|
|
base.ShowDialog();
|
|
|
|
|
|
|
|
return textBox1.Text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|