check point
This commit is contained in:
48
framework/MaterialSkin.Core/Controls/MaterialInputBox.cs
Normal file
48
framework/MaterialSkin.Core/Controls/MaterialInputBox.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using MaterialSkin.Controls;
|
||||
|
||||
namespace MaterialSkin.Core.Controls
|
||||
{
|
||||
public partial class MaterialInputBox : MaterialForm
|
||||
{
|
||||
private MaterialInputBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
public static DialogResult Prompt(string title, string defaultValue, out string result, bool masked = false)
|
||||
{
|
||||
MaterialInputBox box = new MaterialInputBox {label1 = {Text = title}, textBox1 = {Text = defaultValue}};
|
||||
if (masked) box.textBox1.PasswordChar = '*';
|
||||
var res= box.ShowDialog();
|
||||
result = box.textBox1.Text;
|
||||
return res;
|
||||
}
|
||||
|
||||
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Return)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
|
||||
private void materialRaisedButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private void materialRaisedButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user