C ++: Scroll of the scroll bar

Source: Internet
Author: User

C ++: Scroll of the scroll bar

SCROLLINFO scrollinfo;GetScrollInfo(SB_HORZ, &scrollinfo, SIF_ALL);switch (nSBCode){case SB_LINERIGHT:    if (scrollinfo.nPos < scrollinfo.nMax){    scrollinfo.nPos += 10;    SetScrollInfo(SB_HORZ, &scrollinfo);    ScrollWindow(-10, 0);}    break;}

Use GetScrollInfo to obtain the rolling information and save the information to the SCROLLINFO data.

Then, the nSBCode is used to determine the action of the scroll bar and the adjustment is made.

The following lists the functions related to scrolling.

afx_msg void OnHScroll(    UINT nSBCode,    UINT nPos,    CScrollBar* pScrollBar  );

Meanings of parameters:

NSBCode
Specifies the scroll bar code that indicates the user's rolling request. This parameter can be one of the following values:
SB_LEFT scroll to the left.
SB_ENDSCROLL ends the scroll.
SB_LINELEFT scroll.
SB_LINERIGHT: Scroll permission.
SB_PAGELEFT scroll one page.
SB_PAGERIGHT: Scroll one page.
SB_RIGHT: scroll to the rightmost.
SB_THUMBPOSITION is the absolute position of the scroll. The current location isNPosParameter.
Drag SB_THUMBTRACK to the scroll box at the specified position. The current location isNPosParameter.
NPos
If the code of the scroll bar is SB_THUMBPOSITION or SB_THUMBTRACK, specify the scroll box position. Otherwise, it is not used. Based on the initial scroll size, nPos can be negative. Therefore, if necessary, convert to int.
PScrollBar
If the rolling message comes fromScroll bar Control, Including pointing to the control. // If the scroll control is manually added
If you click the window scroll bar, this parameter is NULL.
Pointers may be transient and should not be stored for future use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.