Example #1
0
        public override void OnMouseDown(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            if (UpButtonBounds.Contains(e.Location))
            {
                UpButtonPressed    = true;
                DownButtonPressed  = false;
                DownButtonSelected = false;
                if (UpButtonClicked != null)
                {
                    UpButtonClicked(this, e);
                }
            }
            else if (DownButtonBounds.Contains(e.Location))
            {
                DownButtonPressed = true;
                UpButtonPressed   = false;
                UpButtonSelected  = false;
                if (DownButtonClicked != null)
                {
                    DownButtonClicked(this, e);
                }
            }
            else if (TextBoxBounds.Contains(e.X, e.Y) && AllowTextEdit)
            {
                StartEdit();
            }
        }
Example #2
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            base.OnMouseMove(e);

            bool mustRedraw = false;

            if (UpButtonBounds.Contains(e.Location))
            {
                Owner.Cursor       = Cursors.Default;
                mustRedraw         = !UpButtonSelected || DownButtonSelected || DownButtonPressed;
                UpButtonSelected   = true;
                DownButtonSelected = false;
                DownButtonPressed  = false;
            }
            else if (DownButtonBounds.Contains(e.Location))
            {
                Owner.Cursor       = Cursors.Default;
                mustRedraw         = !DownButtonSelected || UpButtonSelected || UpButtonPressed;
                DownButtonSelected = true;
                UpButtonSelected   = false;
                UpButtonPressed    = false;
            }
            else if (TextBoxBounds.Contains(e.X, e.Y))
            {
                Owner.Cursor       = Cursors.IBeam;
                mustRedraw         = DownButtonSelected || DownButtonPressed || UpButtonSelected || UpButtonPressed;
                UpButtonSelected   = false;
                UpButtonPressed    = false;
                DownButtonSelected = false;
                DownButtonPressed  = false;
            }
            else
            {
                Owner.Cursor = Cursors.Default;
            }

            if (mustRedraw)
            {
                RedrawItem();
            }
        }