开发者

Scrollbar value doesn't update after changing maximum (C# winforms)

开发者 https://www.devze.com 2023-04-05 16:13 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号