更新 VerticalScroll 值时设置选项卡滚动条的位置

发布于 2024-10-20 08:03:11 字数 2122 浏览 4 评论 0原文

我正在 ac# 应用程序内的标签页上动态更新许多控件。选项卡页已启用自动滚动。您可能知道,当用户向下滚动时,它将位置 x=0,y=0 设置为当前的 x=0,y=0。

所以:

+-----------------------------------+
| X                             |---|    X is now 0,0 in terms of setting locations.
|                               | - |
|                               |---|
|                               |   |
|                               |   |
|                               |   |
|                               |   |  
|                               |   |      
|                               |   |
|                               |   |
|             TEXT              |   |
|                               |   |
+-----------------------------------+

因此

+-----------------------------------+
| X                             |   |    X is now 0,0 in terms of setting locations.
|             TEXT              |   |
|                               |   |
|                               |   |
|                               |   |
|                               |---|
|                               | - |  
|                               |---|      
|                               |   |
|                               |   |
|                               |   |
|                               |   |
+-----------------------------------+

我必须保存 VerticalScroll.Value,将其设置为 0,更新控件,然后将 VerticalScroll.Value 设置回原始值。

这在一定程度上有效,选项卡表单的位置是正确的,但是滚动条没有更新,所以它看起来像这样:

+-----------------------------------+
|                               |---|  
|             TEXT              | - |
|                               |---|
|                               |   |
|                               |   |
|                               |   |
|                               |   |  
|                               |   |      
|                               |   |
|                               |   |
|                               |   |
|                               |   |
+-----------------------------------+

有没有简单的方法来更新滚动条的位置?

如果我保持原样,当用户再次单击滚动条时,它会将位置移回选项卡表单的顶部。感谢您提供的任何帮助。

I am updating a number of controls dynamically on a tabpage within a c# application. The tab page has autoscroll enabled. As you may be aware, when the user has scrolled down it sets the location x=0,y=0 to be at the current x=0,y=0.

so:

+-----------------------------------+
| X                             |---|    X is now 0,0 in terms of setting locations.
|                               | - |
|                               |---|
|                               |   |
|                               |   |
|                               |   |
|                               |   |  
|                               |   |      
|                               |   |
|                               |   |
|             TEXT              |   |
|                               |   |
+-----------------------------------+

AND

+-----------------------------------+
| X                             |   |    X is now 0,0 in terms of setting locations.
|             TEXT              |   |
|                               |   |
|                               |   |
|                               |   |
|                               |---|
|                               | - |  
|                               |---|      
|                               |   |
|                               |   |
|                               |   |
|                               |   |
+-----------------------------------+

Therefore I have to save the VerticalScroll.Value, set it to 0, update the controls and then set the VerticalScroll.Value back to the original value.

This works to a degree, the position of the tab form is correct, however the scrollbar doesn't update, so it looks like this:

+-----------------------------------+
|                               |---|  
|             TEXT              | - |
|                               |---|
|                               |   |
|                               |   |
|                               |   |
|                               |   |  
|                               |   |      
|                               |   |
|                               |   |
|                               |   |
|                               |   |
+-----------------------------------+

Is there any easy way to update the position of the scrollbar?

If I leave it as it is, when the user clicks on the scrollbar again it moves the position back to the top of the tab form. Thanks for any help you can provide.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文