BizHawk/BizHawk.Util/HexTextBox.cs

29 lines
546 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk
{
public class HexTextBox : TextBox
{
public HexTextBox()
{
this.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;
}
}
}
}