tags:

views:

28

answers:

1

I have a control where I use SetScrollInfo (user32) to set the nMin and nMax. How can I calculate the right size of the nPage (or the thumbtrack)? I know it must be some percentage of the client area, but I'm not really sure on the calculation. I am not using AutoScroll and associated properties so that I can have maximum control over scrolling.

+1  A: 

I think the documentation at MSDN (Scroll Box Position and Scrolling Range) answers your question. An excerpt:

You can set a page size for a scroll bar. The page size represents the number of data units that can fit in the client area of the owner window given its current size. For example, if the client area can hold 16 lines of text, an application would set the page size to 16. The system uses the page size, along with the scrolling range and length of the scroll bar shaft, to set the size of the scroll box. Whenever a window containing a scroll bar is resized, an application should call the SetScrollInfo function to set the page size.

Bill
Yup! You are spot on with this. Thanks!
TheCloudlessSky