Board index » Visual Studio » how to define scroll bar's page size value?

how to define scroll bar's page size value?

Visual Studio313
Hi all,



I have a confusion about calculating scroll bar's page size.



In my application, I am drawing an image according to scroll bar

position.



m_iGeneratedImgWidth - Width size of the image (this value is always

bigger)

rect.right - Width of the drawing area.



how to define scroll bar's page size value?



SCROLLINFO info;

info.cbSize = sizeof(SCROLLINFO);

info.fMask = SIF_RANGE|SIF_PAGE|SIF_POS;

info.nPos = 0;

info.nMin = 0;

info.nMax = m_iGeneratedImgWidth - rect.right;

info.nPage = ?



In my OnHScrollBar() function, for SB_PAGELEFT / SB_PAGERIGHT codes, I

subtract/add 10 for displaying image.



I want to set correct value, because this is the only way to change

size of the tracking thumb of scroll bar control.



:)

Purusothaman A


-
 

Re:how to define scroll bar's page size value?

A page size value is whatever you want it to be. In your WM_HSCROLL or WM_VSCROLL

handlers you increment or decrement the value by whatever you feel like. For example, for

a "page" you might increment or decrement by the GetClientRect() values Width() or

Height() values appropriately. Or half of them. Or 3/4 of them. Or whatever.



The thumb size, which is the thumb size, has nothing to do with the amount of space you

will scroll on a page-up/down or page-left/right operation. Instead, it is the amount of

the range that is visible.



So if you have a window 200 pixels high, and you have an image 800 pixels high, you might

set the scroll range to be 0..600 (that's 0..(picture size - client height)). You would

set the nPage value to 200. This would give a wide thumb position. It would *not* change

the amount you scroll in a WM_HSCROLL/WM_VSCROLL handler when a page request comes in. It

just shows the amount of the image being shown.

joe



On 10 Jan 2007 00:33:43 -0800, "Purusothaman A" <Purusothaman.A@gmail.com>wrote:



Quote
Hi all,



I have a confusion about calculating scroll bar's page size.



In my application, I am drawing an image according to scroll bar

position.



m_iGeneratedImgWidth - Width size of the image (this value is always

bigger)

rect.right - Width of the drawing area.



how to define scroll bar's page size value?



SCROLLINFO info;

info.cbSize = sizeof(SCROLLINFO);

info.fMask = SIF_RANGE|SIF_PAGE|SIF_POS;

info.nPos = 0;

info.nMin = 0;

info.nMax = m_iGeneratedImgWidth - rect.right;

info.nPage = ?



In my OnHScrollBar() function, for SB_PAGELEFT / SB_PAGERIGHT codes, I

subtract/add 10 for displaying image.



I want to set correct value, because this is the only way to change

size of the tracking thumb of scroll bar control.



:)

Purusothaman A

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

-

Re:how to define scroll bar's page size value?



Thanks Joseph M.Newcomer for your nice reply.



:)

Purusothaman A



"Joseph M. Newcomer" wrote:



Quote
A page size value is whatever you want it to be. In your WM_HSCROLL or WM_VSCROLL

handlers you increment or decrement the value by whatever you feel like. For example, for

a "page" you might increment or decrement by the GetClientRect() values Width() or

Height() values appropriately. Or half of them. Or 3/4 of them. Or whatever.



The thumb size, which is the thumb size, has nothing to do with the amount of space you

will scroll on a page-up/down or page-left/right operation. Instead, it is the amount of

the range that is visible.



So if you have a window 200 pixels high, and you have an image 800 pixels high, you might

set the scroll range to be 0..600 (that's 0..(picture size - client height)). You would

set the nPage value to 200. This would give a wide thumb position. It would *not* change

the amount you scroll in a WM_HSCROLL/WM_VSCROLL handler when a page request comes in. It

just shows the amount of the image being shown.

joe



On 10 Jan 2007 00:33:43 -0800, "Purusothaman A" <Purusothaman.A@gmail.com>wrote:



>Hi all,

>

>I have a confusion about calculating scroll bar's page size.

>

>In my application, I am drawing an image according to scroll bar

>position.

>

>m_iGeneratedImgWidth - Width size of the image (this value is always

>bigger)

>rect.right - Width of the drawing area.

>

>how to define scroll bar's page size value?

>

>SCROLLINFO info;

>info.cbSize = sizeof(SCROLLINFO);

>info.fMask = SIF_RANGE|SIF_PAGE|SIF_POS;

>info.nPos = 0;

>info.nMin = 0;

>info.nMax = m_iGeneratedImgWidth - rect.right;

>info.nPage = ?

>

>In my OnHScrollBar() function, for SB_PAGELEFT / SB_PAGERIGHT codes, I

>subtract/add 10 for displaying image.

>

>I want to set correct value, because this is the only way to change

>size of the tracking thumb of scroll bar control.

>

>:)

>Purusothaman A

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm



-