Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. public class NumericUpDownFix : System.Windows.Forms.NumericUpDown
  2. {
  3.     protected override void OnValueChanged(EventArgs e)
  4.     {
  5.         if (Value > _value)
  6.         {
  7.             LastDirection = 1;
  8.         }
  9.         else if (Value < _value)
  10.         {
  11.             LastDirection = -1;
  12.         }
  13.         else
  14.         {
  15.             LastDirection = 0;
  16.         }
  17.         _value = Value;
  18.         base.OnValueChanged(e);
  19.     }
  20.  
  21.     protected override void OnClick(EventArgs e)
  22.     {
  23.         base.OnClick(e);
  24.         LastDirection = 0;
  25.     }
  26.  
  27.     private decimal _value;
  28.     public int LastDirection = -2;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement