Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public class TestNum : NumericUpDown
  2. {
  3. protected override void ValidateEditText()
  4. {
  5. if (base.UserEdit)
  6. {
  7. base.ValidateEditText();
  8. }
  9. }
  10.  
  11. protected override void UpdateEditText()
  12. {
  13. Text = Convert.ToInt32(base.Value).ToString("00");
  14. }
  15. }
  16.  
  17. this.numTest = new System.Windows.Forms.NumericUpDown();
  18. private System.Windows.Forms.NumericUpDown numTest;
  19.  
  20. this.numTest = new SampleForm.TestNum();
  21. private TestNum numTest;
  22.  
  23. public class HexNumericUpDown : System.Windows.Forms.NumericUpDown
  24. {
  25. public HexNumericUpDown()
  26. {
  27. Hexadecimal = true;
  28. }
  29.  
  30. protected override void ValidateEditText()
  31. {
  32. if (base.UserEdit)
  33. {
  34. base.ValidateEditText();
  35. }
  36. }
  37.  
  38. protected override void UpdateEditText()
  39. {
  40. Text = System.Convert.ToInt64(base.Value).ToString("X" + HexLength);
  41. }
  42.  
  43. [System.ComponentModel.DefaultValue(4)]
  44. public int HexLength
  45. {
  46. get { return m_nHexLength; }
  47. set { m_nHexLength = value; }
  48. }
  49.  
  50. public new System.Int64 Value
  51. {
  52. get { return System.Convert.ToInt64(base.Value); }
  53. set { base.Value = System.Convert.ToDecimal(value); }
  54. }
  55.  
  56. private int m_nHexLength = 4;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement