Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestNum : NumericUpDown
- {
- protected override void ValidateEditText()
- {
- if (base.UserEdit)
- {
- base.ValidateEditText();
- }
- }
- protected override void UpdateEditText()
- {
- Text = Convert.ToInt32(base.Value).ToString("00");
- }
- }
- this.numTest = new System.Windows.Forms.NumericUpDown();
- private System.Windows.Forms.NumericUpDown numTest;
- this.numTest = new SampleForm.TestNum();
- private TestNum numTest;
- public class HexNumericUpDown : System.Windows.Forms.NumericUpDown
- {
- public HexNumericUpDown()
- {
- Hexadecimal = true;
- }
- protected override void ValidateEditText()
- {
- if (base.UserEdit)
- {
- base.ValidateEditText();
- }
- }
- protected override void UpdateEditText()
- {
- Text = System.Convert.ToInt64(base.Value).ToString("X" + HexLength);
- }
- [System.ComponentModel.DefaultValue(4)]
- public int HexLength
- {
- get { return m_nHexLength; }
- set { m_nHexLength = value; }
- }
- public new System.Int64 Value
- {
- get { return System.Convert.ToInt64(base.Value); }
- set { base.Value = System.Convert.ToDecimal(value); }
- }
- private int m_nHexLength = 4;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement