mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-01 09:25:28 +00:00
37 lines
892 B
C#
37 lines
892 B
C#
using System;
|
|
using System.Windows.Forms;
|
|
using MetroFramework.Forms;
|
|
|
|
namespace PckStudio
|
|
{
|
|
public partial class RenamePrompt : MetroForm
|
|
{
|
|
/// <summary>
|
|
/// Text entered <c>only access when DialogResult == DialogResult.OK</c>
|
|
/// </summary>
|
|
public string NewText => InputTextBox.Text;
|
|
|
|
public RenamePrompt(string InitialText) : this(InitialText, -1)
|
|
{ }
|
|
|
|
public RenamePrompt(string InitialText, int maxChar)
|
|
{
|
|
InitializeComponent();
|
|
InputTextBox.Text = InitialText;
|
|
InputTextBox.MaxLength = maxChar < 0 ? short.MaxValue : maxChar;
|
|
FormBorderStyle = FormBorderStyle.None;
|
|
}
|
|
|
|
private void OKBtn_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
}
|
|
|
|
private void InputTextBox_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
OKBtn_Click(sender, e);
|
|
}
|
|
}
|
|
}
|