C# UserControl.VerticalScroll.Value not being set

后端 未结 4 1426
野趣味
野趣味 2020-12-20 21:00

I\'ve got a chunk of C# code that is supposed to set VerticalScroll.Value within a class that inherits from UserControl. It gets called when any child object of the class c

4条回答
  •  一个人的身影
    2020-12-20 21:54

    I was running into the same problem, and I found a solution on the MSDN webpage (won't let me post links, 'cause I'm a new user).

    The suggested solution was to assign to .Value twice, and it worked for me:

    int newVerticalScrollValue = 
             pDashboard.VerticalScroll.Value - pDashboard.VerticalScroll.SmallChange;
    
    pDashboard.VerticalScroll.Value = newVerticalScrollValue;
    pDashboard.VerticalScroll.Value = newVerticalScrollValue;
    

提交回复
热议问题