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 7733317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:57:28+00:00 2026-06-01T06:57:28+00:00

In my graphics application, there is canvas area that has some graph. The scrollbars

  • 0

In my graphics application, there is canvas area that has some graph. The scrollbars associated with the x- cordinate and y-cordinate must be in sync with this viewport area of the canvas (where the graph is present).
When a user clicks on a zoom button the graph is zoomed in and out. Now the problem is setting the scrollbar for this zooming. On zoomin in or out, the viewport of the scrollbar should be in sync with the percentage of zoom.

How to set the thumb size of the scrollbar in this case.
I have the Maximum , Minimum and Value property of the scrollbar
and the entire graph width and height with the zoomfactor.

How should I set the ViewportSize or the thumb size of the scrollbar?

I used the below code snippet to get the ViewportSize but its not accurate

mScrollBarY.ViewportSize = (double)yAxis.CurrentValueRange;

where the CurrentValueRange gives the zoomed in visible range.

  • 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-01T06:57:29+00:00Added an answer on June 1, 2026 at 6:57 am

    Here I see two approaches:

    1. Viewport remaines the same, while Extent grows as you zoom in and decreases down to Viewport size as you zoom out. So you need to update Maximum
    2. Extent remains the same, while Viewport grows up to Extent size as you zoom out and decreases as you zoom in.

    EDIT

    In both variants you need to define some factor to increase or decrease by. Let it be scale_factor. Here’s the method to update ScrollBar:

    void updateScrollBar()
    {
        scrollBar.Minimum = 0;
        scrollBar.Maximum = extent;
        scrollBar.ViewportSize = viewport * scale_factor;
        scrollBar.SmallChange = 10 * scale_factor;
    }
    

    Zoom In handler:

    scale_factor /= 2;
    updateScrollBar();
    

    Zoom out handler:

    scale_factor *= 2;
    updateScrollBar();
    

    By the way, I found the following formula at msdn forum:

    ThumbSize = TrackLength * ViewportSize / (Maximum - Minimum + ViewportSize)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that, to this point, is mostly DirectX 10 3D graphics.
Just tried some small graphics application of mine on Windows 7, and I'm getting
I'm working on a graphics application that is using virtual classes fairly extensively. It
I've got an application that is very graphics intensive and built on DirectX and
I am developing the application that uses DirectX for graphics rendering. I have to
I found this question Intensive graphics application in C# (with .NET/Mono) regarding graphics applications
I'm building a Flex application that creates neat vector images based on some options/filters.
I'm writing a graphics application that's maths and geometry intensive. Frequently, I find that
I have a MFC document/view C++ graphics application that does all its drawing to
I've to draw a graph on a canvas (bound by a scrollviewer). And there

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.