BizHawk/BizHawk.Util/HexTextBox.cs

25 lines
451 B
C#

using System.Windows.Forms;
namespace BizHawk
{
public class HexTextBox : TextBox
{
public HexTextBox()
{
CharacterCasing = CharacterCasing.Upper;
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (e.KeyChar == '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
{
return;
}
else if (!InputValidate.IsValidHexNumber(e.KeyChar))
{
e.Handled = true;
}
}
}
}