Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:52:00+00:00 2026-06-13T16:52:00+00:00

I have an image that I want to increase the size or decrease the

  • 0

I have an image that I want to increase the size or decrease the size if the mouse wheel is scrolled up or down accordingly. If the image reaches a set max size it will not get ant larger and vice versa if making the image smaller. The problem I am having is once you reach the maximum size of the image and continue scrolling up then go to scroll down the image will not get smaller right away until you scrolled down the same number of times you scrolled up while having the image at the max size and again reverse for making the image smaller. ScrollWheelValue is an read only property so it cannot be reset. I was trying to add some logic where if the wheel is scrolled up and the image is max size subtract 120 because 120 is what the mouse increases per scroll. Can anyone help me with this issue? Thanks very much

Original Code:

        float scale = ms.ScrollWheelValue / 120;

        scaleFactor = scale * scaleChange;

        if (scaleFactor > MAX_SCALE)
        {
            scaleFactor = MAX_SCALE;


        }

        else if (scaleFactor < MIN_SCALE)
        {
            scaleFactor = MIN_SCALE;


        }            

New Code:

        if (scaleFactor > MAX_SCALE)
        {
            scaleFactor = MAX_SCALE;
            float newScale = ms.ScrollWheelValue / 120;
            if (newScale > scale)
            {
                scaleCount = scaleCount - 120;
            }
            if (newScale < scale)
            {
                scaleCount = scaleCount + 120;
            }

        }

        else if (scaleFactor < MIN_SCALE)
        {
            scaleFactor = MIN_SCALE;
            float newScale = ms.ScrollWheelValue / 120;
            if (newScale > scale)
            {
                scaleCount = scaleCount - 120;
            }
            if (newScale < scale)
            {
                scaleCount = scaleCount + 120;
            }

        }

        else
        {
            scale = ms.ScrollWheelValue / 120 + scaleCount;

            scaleFactor = scale * scaleChange;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:52:01+00:00Added an answer on June 13, 2026 at 4:52 pm

    If you read:
    MSDN MouseState Scroll Wheel Value

    You’ll see that it keeps a running value from the beginning of the game. So what you want to do is check it for a change vs. the previous value and do something accordingly.

    How you have it set up it seems you don’t care about the actual value, just the difference since the last time they scrolled the wheel.

    declare these outside of your update loop:

    float prevWheelValue;
    float currWheelValue;
    

    Then in your update:

    prevWheelValue = currWheelValue;
    currWheelValue = ms.ScrollWheelValue;
    

    now your checks can simply be if prevWheelValue > < or == to currWheelValue and clamp the value to the boundaries that you want.

    Mathhelper.Clamp

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to increase the size of cell image which I have set like
I have an image that I want to position in the right and repeat
I have an image that I want to resize on my websites rendering using
I have an image that I want to move. I can move the element
I am using GWT 2.03 and am have an image that I want to
I have an image that is too big and I want to put it
I have emoticons in a css sprite image that I want to display within
I have a 16 bit grayscale image that I want to display using WPF
I want to be able to take an image that i have already captured
I have a page http://www.mysite.com/image.aspx , that I want to load and display an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.