/[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

--- trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs	2012/06/05 02:19:13	286
+++ trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs	2012/06/05 08:52:07	287
@@ -9,6 +9,7 @@
 
 namespace System.Windows.Forms
 {
+    [DefaultEvent("ValueChanged")]
     public partial class MaskedHexBox : UserControl
     {
         public MaskedHexBox()
@@ -23,8 +24,12 @@
             this.isAddressMask = true;
             txtMaskedHexBox.KeyDown += new KeyEventHandler(txtMaskedHexBox_KeyDown);
             txtMaskedHexBox.TextAlign = HorizontalAlignment.Right;
-
+            ValueChanged = null;
         }
+        [Browsable(true)]
+        [Category("Property Changed")]
+        [Description("Raised when the Value displayed changes.")]
+        public event EventHandler<ValueChangedEventArgs> ValueChanged;
 
         private void MaskedHexBox_KeyDown(object sender, KeyEventArgs e)
         {
@@ -78,6 +83,7 @@
             get { return this.ToInt64(); }
             set
             {
+                long old_value = this.Value;
                 switch (this.TextLength)
                 {
                     case 0:
@@ -91,6 +97,9 @@
                     case 8: this.Text = string.Format("0x{0:x8}", value); break;
                     default: this.Text = string.Format("0x{0:x" + this.TextLength + "}", value); break;
                 }
+                long new_value = this.Value;
+                if ((new_value!= old_value) && ValueChanged != null)
+                    ValueChanged(this, new ValueChangedEventArgs(old_value, new_value));
             }
         }
         private bool _isAddressMask;

 

  ViewVC Help
Powered by ViewVC 1.1.22