Exemple #1
0
        public NumericScan()
        {
            txtbox              = new TextBox();
            txtbox.Parent       = this;
            txtbox.TextAlign    = HorizontalAlignment.Right;
            txtbox.Text         = ValueToText(mValue);
            txtbox.TextChanged += TextBoxOnTextChanged;
            txtbox.KeyDown     += TextBoxOnKeyDown;

            btn1              = new ArrowButton();
            btn1.Parent       = this;
            btn1.Text         = "btn1";
            btn1.ScrollButton = ScrollButton.Left;
            btn1.Click       += ButtonOnClick;

            btn2              = new ArrowButton();
            btn2.Parent       = this;
            btn2.Text         = "btn2";
            btn2.ScrollButton = ScrollButton.Right;
            btn2.Click       += ButtonOnClick;

            Width  = 4 * Font.Height;
            Height = txtbox.PreferredHeight +
                     SystemInformation.HorizontalScrollBarHeight;
        }
Exemple #2
0
        void ButtonOnClick(object objSrc, EventArgs args)
        {
            ArrowButton btn       = objSrc as ArrowButton;
            decimal     mNewValue = Value;

            if (btn == btn1)
            {
                if ((mNewValue -= Increment) < Minimum)
                {
                    return;
                }
            }

            if (btn == btn2)
            {
                if ((mNewValue += Increment) > Maximum)
                {
                    return;
                }
            }

            Value = mNewValue;
            OnValueChanged(EventArgs.Empty);
        }