/[RomCheater]/trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs
ViewVC logotype

Diff of /trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 249 by william, Sun Jun 3 16:09:05 2012 UTC revision 287 by william, Tue Jun 5 08:52:07 2012 UTC
# Line 9  using System.Runtime.InteropServices; Line 9  using System.Runtime.InteropServices;
9    
10  namespace System.Windows.Forms  namespace System.Windows.Forms
11  {  {
12        [DefaultEvent("ValueChanged")]
13      public partial class MaskedHexBox : UserControl      public partial class MaskedHexBox : UserControl
14      {      {
15          public MaskedHexBox()          public MaskedHexBox()
# Line 23  namespace System.Windows.Forms Line 24  namespace System.Windows.Forms
24              this.isAddressMask = true;              this.isAddressMask = true;
25              txtMaskedHexBox.KeyDown += new KeyEventHandler(txtMaskedHexBox_KeyDown);              txtMaskedHexBox.KeyDown += new KeyEventHandler(txtMaskedHexBox_KeyDown);
26              txtMaskedHexBox.TextAlign = HorizontalAlignment.Right;              txtMaskedHexBox.TextAlign = HorizontalAlignment.Right;
27                ValueChanged = null;
28          }          }
29            [Browsable(true)]
30            [Category("Property Changed")]
31            [Description("Raised when the Value displayed changes.")]
32            public event EventHandler<ValueChangedEventArgs> ValueChanged;
33    
34          private void MaskedHexBox_KeyDown(object sender, KeyEventArgs e)          private void MaskedHexBox_KeyDown(object sender, KeyEventArgs e)
35          {          {
# Line 78  namespace System.Windows.Forms Line 83  namespace System.Windows.Forms
83              get { return this.ToInt64(); }              get { return this.ToInt64(); }
84              set              set
85              {              {
86                    long old_value = this.Value;
87                  switch (this.TextLength)                  switch (this.TextLength)
88                  {                  {
89                      case 0:                      case 0:
# Line 91  namespace System.Windows.Forms Line 97  namespace System.Windows.Forms
97                      case 8: this.Text = string.Format("0x{0:x8}", value); break;                      case 8: this.Text = string.Format("0x{0:x8}", value); break;
98                      default: this.Text = string.Format("0x{0:x" + this.TextLength + "}", value); break;                      default: this.Text = string.Format("0x{0:x" + this.TextLength + "}", value); break;
99                  }                  }
100                    long new_value = this.Value;
101                    if ((new_value!= old_value) && ValueChanged != null)
102                        ValueChanged(this, new ValueChangedEventArgs(old_value, new_value));
103              }              }
104          }          }
105          private bool _isAddressMask;          private bool _isAddressMask;

Legend:
Removed from v.249  
changed lines
  Added in v.287

  ViewVC Help
Powered by ViewVC 1.1.22