67 lines
1.6 KiB
C#
67 lines
1.6 KiB
C#
|
using System;
|
||
|
using System.Windows.Forms;
|
||
|
|
||
|
namespace RyzStudio.Windows.ThemedForms
|
||
|
{
|
||
|
public partial class TextBoxForm : Form
|
||
|
{
|
||
|
public TextBoxForm(string title, string labelText, string defaultValue)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
|
||
|
this.Text = title;
|
||
|
label2.Text = labelText;
|
||
|
textBox1.Text = defaultValue;
|
||
|
}
|
||
|
|
||
|
public TextBoxForm(string title, string labelText, string defaultValue, bool password)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
|
||
|
this.Text = title;
|
||
|
label2.Text = labelText;
|
||
|
textBox1.Text = defaultValue;
|
||
|
textBox1.UseSystemPasswordChar = password;
|
||
|
}
|
||
|
|
||
|
public TextBoxForm(string title, string labelText)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
|
||
|
this.Text = title;
|
||
|
label2.Text = labelText;
|
||
|
}
|
||
|
|
||
|
public TextBoxForm(string title, string labelText, bool password)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|