刷新winform上的滚动条 [英] Refresh scroll bars on winform
问题描述
我在 VB.Net 中有一个主表单,我在其中添加了一个子表单.子表单的 TopLevel 属性为 false.我激活了主窗体上的滚动条(AutoScroll = true).
I have a main-form in VB.Net in which I add a sub-form. The sub-form has the property TopLevel to false. I activated the scroll bars on the main-form (AutoScroll = true).
现在,在运行时,当我在主窗体内移动子窗体时,滚动条不会立即出现.我应该稍微调整一下主窗体的大小,以便将子窗体的位置考虑在内.
Now, at run-time, when I move the sub-form inside the main-form, the scroll bars don't appear immediatly. I should resize the main-form little bit in order to take the position of the sub-form into consideration.
这是一个显示我的问题的视频:https://www.dropbox.com/s/eha23pc91ozrtni/2013-11-05%2006h02_41.mp4
Here is a video showing my problem : https://www.dropbox.com/s/eha23pc91ozrtni/2013-11-05%2006h02_41.mp4
我在子表单中添加了以下代码以在移动时刷新主表单但它不起作用.
I added the following code in the sub-form to refresh the main one in case of move but it's not working.
Private Sub Form2_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
Me.Parent.Refresh()
End Sub
我也试过
Me.ParentForm.AdjustFormScrollbars(True)
但我遇到了编译错误,重载解析失败,因为无法访问AdjustFormScrollbars".
but I'm having a compilation error, Overload resolution failed because no 'AdjustFormScrollbars' is accessible.
有谁知道如何刷新"主窗体上的滚动条?
Does anyone know how to "refresh" the scroll bars on the main-form ?
谢谢.
推荐答案
得到答案:
Private Sub Form2_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
Me.ParentForm.PerformLayout()
End Sub
这篇关于刷新winform上的滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!