Scrollbar value doesn't update after changing maximum (C# winforms)
If my scrollbar's value and maximum is both 500 and I change the maximum to 250 the value is still 500. When changing maximum I want value to automatically update.
Currently every time I change maximum I manu开发者_运维百科ally adjust value and it is quite tedious and repetitive.
Any solutions?
One workaround for this is to leave the maximum the same, and scale the scroll value in your application using a separate variable. For example, instead of changing the scrollbar maximum from 500 to 250, multiply the value of a variable, Q for this example, by .5. Then multiply the scrollbar.value by Q whenever you use it in the application.
精彩评论