Skip to content

Feature Request: Adding a step size #1

Closed

Description

@TheMinefighter

Sometimes a custom Step Size would be really useful, which would change by how much the arrows change the value. Implementation in the OnIncrease and OnDecrease method as follows:

        /// <summary>
        /// Increase the displayed integer value
        /// </summary>
        protected virtual void OnIncrease()
        {
            if (this.Value >= this.MaxValue)
            {
                // Value is not incremented if it is already maxed or above
                this.Value = this.MaxValue;
            }
            else
            { 
                if (this.Value + this.StepSize <= this.MaxValue)
                    this.Value = (int) (this.Value + this.StepSize);
                else
                {
                    if (this.Value <= this.MinValue)
                    {
                        // Value is not incremented if it is already min or below
                        this.Value = this.MinValue;
                    }
                }
            }
        }

        /// <summary>
        /// Decrease the displayed integer value
        /// </summary>
        protected virtual void OnDecrease()
        {
            if (this.Value <= this.MinValue)
            {
                // Value is not decremented if it is already minimum or below
                this.Value = this.MinValue;
            }
            else
            {
                if (this.Value - this.StepSize > this.MinValue)
                    this.Value = (int) (this.Value - this.StepSize);
                else
                {
                    if (this.Value >= this.MaxValue)
                    {
                        // Value is not incremented if it is already maxed or above
                        this.Value = this.MaxValue;
                    }
                }
            }
        }

Activity

  1. Dirkster99 commented on Jun 28, 2018

    @Dirkster99
    Owner

    Thanks for the good feature description - its implemented with version 1.0.3 of the library and nuget package (it may take some time until you can download the opackage:
    Dirkster.NumericUpDownLib 1.0.3

    as soon as its available on nuget (usually 30-60 mins).

    I close this assuming its resolved but feel free to re-open should you find problems with this.

    Install-Package Dirkster.NumericUpDownLib -Version 1.0.3

  2. added 3 commits that reference this issue on Oct 20, 2022
    9580143
    b201cdf
    e847626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions