Windows Scroll Bar

Windows Predefined Controls – Part 27
Volume – Windows User Interface

Introduction
This is part 27 of my series, Windows Predefined Controls. In order to understand this tutorial, you must have read all the previous tutorials of the series. In this part of the series, we look at Windows Scroll Bar.

Note: If you cannot see the code or if you think anything is missing (broken link, image absent), just contact me at forchatrans@yahoo.com. That is, contact me for the slightest problem you have about what you are reading.

Why a Scroll Bar
The size of the computer screen is limited (in width and height). The size of a window, smaller than the computer screen is more limited. You can have a document or an image that is more than the size of the client area of a window; yet you want the user to be able to see the whole document or images when it is displayed in the client window. To achieve this, you need scroll bar for the window.

What is a scroll bar?
A scroll bar is a vertical or horizontal bar in a window or control. A scroll bar is made up of a shaded shaft with an arrow button at each end and a scroll box between the two arrow buttons. This scroll box is sometimes called a thumb. A scroll bar represents the overall height (going downward) or width of a data in a window’s client area; the scroll box indicates the portion of the data that is visible in the client area. You must have seen scroll bars as you use windows applications. You can have a veridical scroll bar and/or a horizontal scroll bar in a window.

The position of the scroll box changes whenever the user scrolls data to display different portions. The operating system also adjusts the size of a scroll bar’s scroll box so that it indicates what portion of the entire data is currently visible in the window. If most of the data is visible, the scroll box occupies most of the scroll bar shaft. On the other hand, if only a small portion of the object is visible, the scroll box occupies a small part of the scroll bar shaft.

The user can scroll the content in the window or control by clicking one of the arrow buttons. He can also scroll the content by clicking the area in the shaded scroll bar shaft, or by dragging the scroll box.

If the user clicks an arrow button, the application or operating system would scroll the content by one unit (typically a single line vertically or column horizontally). When the user clicks the shaded areas, the application scrolls the content by one window. The amount of scrolling that occurs when the user drags the scroll box depends on the distance the user drags the scroll box and on the scrolling range of the scroll bar.

Scrolling Range
You can move the scroll box from one end of the scroll bar to the other. That distance is the scrolling range. It has a range of integers associated with it say from 0 to 100. The scroll box can have a position anywhere within that range.

Parts of a Scroll Bar
You now know that we can have a vertical scroll bar and a horizontal scroll bar. We know that a scroll bar has two arrow buttons at its ends and a scroll box.

For a vertical scroll bar, the arrow button at the top can be called the lineup button. The shaded area between the lineup button and the scroll box can be called the pageup button. The arrow button at the bottom can be called the linedown button. The shaded area between the linedown button and the scroll box can be called the pagedown button.

For a horizontal scroll bar, the arrow button at the left can be called the lineleft button. The shaded area between the lineleft button and the scroll box can be called the pageleft button. The arrow button at the right can be called the lineright button. The shaded area between the lineright button and the scroll box can be called the pageright button.

Creating a Scroll Box
This is one of the easiest things to create in windows. So far we have been using the CreateWindowEx function to create windows and controls. This function has the dwStyle argument whose value are the styles for the window or control. To create a vertical scroll bar, just add the windows style, WS_HSCROLL to the dwStyle argument. Also, to create a horizontal scroll bar, just add the windows style, WS_VSCROLL to the dwStyle argument.

When you create a scroll bar this way, we say you have created a standard scroll bar. A standard scroll bar is located in the nonclient area of a window. Alternatively, you can create a scroll bar as a control. That comes with some advantages; however, I will not discuss scroll bars as controls in this series.

That is it for this part of the series. We stop here and continue in the next part.

Chrys

To arrive at any of the parts of this series, just type the corresponding title below in the Search Box of this page and click Search (use menu if available):

Combo Box functions
Windows Scroll Bar
Windows Toolbar Control
 

Written by Chrys

Find More Bars Articles

Comments

  1. seo elite online seo backlinks seo backlinks

  2. how’s life ? http://www.mynightout.info owner discovered your blog via Google but it was hard to find and I see you could have more visitors because there are not so many comments yet. I have discovered site which offer to dramtically increase traffic to your site http://xrumerservice.org they claim they managed to get close to 1000 visitors/day using their services you could also get lot more targeted traffic from search engines as you have now. I used their services and got significantly more visitors to my blog. Hope this helps :) They offer seo backlink seo rating backlink service purchase backlinks Take care. Jay

  3. nice to be here http://www.mynightout.info blogger found your site via search engine but it was hard to find and I see you could have more visitors because there are not so many comments yet. I have discovered website which offer to dramtically increase traffic to your website http://xrumerservice.org they claim they managed to get close to 1000 visitors/day using their services you could also get lot more targeted traffic from search engines as you have now. I used their services and got significantly more visitors to my blog. Hope this helps :) They offer search engine ranking software seo black hat backlinks build backlinks Take care. John

  4. Most powerful&cost effective SEO and website traffic service in world get up to 100’000 forum backlinks now!
    Get amazing web traffic using best backlink service available. We can post your custom post up to 100’000 forums around the web, get insane amount of backlinks and incredible targeted web traffic in shortest time. Most affordable and most powerful service for web traffic and backlinks in the world!!!!
    Your post will be published up to 100000 forums worldwide your website or blog will get instant traffic and massive increase in seo rankings just after few days or weeks so your site will get targeted long term traffic from search engines. Order now:
    backlink service

  5. seo backlink says:

    hiya and welcome http://www.mynightout.info admin discovered your site via search engine but it was hard to find and I see you could have more visitors because there are not so many comments yet. I have found site which offer to dramatically increase traffic to your blog http://xrumerservice.org they claim they managed to get close to 1000 visitors/day using their services you could also get lot more targeted traffic from search engines as you have now. I used their services and got significantly more visitors to my website. Hope this helps :) They offer better search engine rankings best seo backlinks 1000 backlinks Take care. steve

  6. backlinks says:

    Best Xrumer service – we post your custom post up to 100K forums worldwide price starting only form $29
    Get amazing online web traffic using best xrumer service today. We can post your marketing post up to 100K forums around the web, get thousands of backlinks and amazing online web traffic in very short time. Most affordable and most powerful service for web traffic and backlinks in the world!!!!
    Your post will be published up to 100000 forums worldwide your website will get insatnt traffic and massive increase in seo rankings just after few days or weeks. Order now:
    backlinks service

  7. Biliphipt says:

    Earn up to $3500/month just by taking simple surveys online!

    I tried one of those online survey sites about 4 months ago that
    say all you have to do is spend a couple of minutes filling out
    some surveys and you will be making hundreds a day….. YEAH RIGHT, I didn’t make anything.

    I joined 7 of these stupid websites and I actually tried filling
    out a couple of surveys on each site and they took forever then at
    the end they wanted me to buy things or I couldn’t complete the
    survey.

    These are complete scams so be aware!!! I couldn’t believe they
    were even allowed to sell such bogus products.

    Then about 2 weeks ago I was watching the news and they had some
    vice presidents and marketing managers of some major multi million
    dollar companies talking about a site that they personally work
    with to pay consumers for their opinion, A site that actually just
    wants the “average Joe’s” honest opinion on products and services
    and is willing to pay big money to get them. for more information
    clik here: http://get-money-for-taking-surveys.info

  8. Cornelia says:

    Shiver me tibrmes, them’s some great information.

  9. Biliphipt says:

    Earn up to $3500/month just by taking simple surveys online!

    I tried one of those online survey sites about 4 months ago that
    say all you have to do is spend a couple of minutes filling out
    some surveys and you will be making hundreds a day….. YEAH RIGHT, I didn’t make anything.

    I joined 7 of these stupid websites and I actually tried filling
    out a couple of surveys on each site and they took forever then at
    the end they wanted me to buy things or I couldn’t complete the
    survey.

    These are complete scams so be aware!!! I couldn’t believe they
    were even allowed to sell such bogus products.

    Then about 2 weeks ago I was watching the news and they had some
    vice presidents and marketing managers of some major multi million
    dollar companies talking about a site that they personally work
    with to pay consumers for their opinion, A site that actually just
    wants the “average Joe’s” honest opinion on products and services
    and is willing to pay big money to get them. for more information
    clik here: http://take-survey-and-get-money.info

  10. Exiccarry says:

    Yes, that’s right. We’ll pay you $25 when you sign up with us today!

    We have an instant $25 market research survey you can take as soon as you join.

    http://get-money-for-your-opinion.info

    Imagine companies paying you just to get your opinion about whether or not
    you like their products sound too good to be true? It isn’t.
    Thousands of companies are hiring people right now to do just that!

    There are opportunities worldwide, so it doesn’t even matter what country you’re from.

    When you join today, you’ll have THOUSANDS of surveys at your fingertips paying anywhere from $25-$50.

    You can take these online from home, on vacation or anywhere you have an internet connection.’

    Now is a better time than ever to get started! Take advantage of the instant $25 survey today!

    Click Below To Get Started Now:

    http://get-money-for-your-opinion.info

    Looking forward to working with you.

    Regards,
    Jenny Adams

Speak Your Mind

*