Method SetScrollbar
SetScrollbar(int?, int?, int?, bool)
Sets the native scrollbar properties.
void SetScrollbar(int? position, int? range, int? pageSize, bool refresh = true)
Parameters
position
int?The position of the scrollbar in scroll units.
range
int?The maximum position of the scrollbar.
pageSize
int?The size of the page size in scroll units. This is the number of units the scrollbar will scroll when it is paged up or down. Often it is the same as the thumb size.
refresh
booltrue
to redraw the scrollbar,false
otherwise.
Remarks
Let's say you wish to display 50 lines of text, using the same font. The window is sized so that you can only see 16 lines at a time. You would use: scrollbar.SetScrollbar(0, 16, 50, 15); The page size is 1 less than the thumb size so that the last line of the previous page will be visible on the next page, to help orient the user. Note that with the window at this size, the thumb position can never go above 50 minus 16, or 34. You can determine how many lines are currently visible by dividing the current view size by the character height in pixels. When defining your own scrollbar behaviour, you will always need to recalculate the scrollbar settings when the window size changes. You could therefore put your scrollbar calculations and SetScrollbar() call into a function named AdjustScrollbars, which can be called initially and also from a size event handler function.