SplitPanel 中的控制锚点不适用于用户设置
在 .NET 4.0 Windows 窗体应用程序中,我有一个带有多行 TextBox
的 SplitPanel
(将 Anchor
设置为 Top,下、左、右
)在第一个面板中。如果我在设计器或正在运行的应用程序中移动拆分器,则与每个边界的距离都可以完美保持。
SplitterDistance
< /a> 属性绑定到用户范围设置。
但是,如果单独修改 SplitterDistance
的值并且重新启动应用程序或重新加载设计器,则此方法不起作用。重新加载或启动时,所讨论的距离是错误的,但在进一步调整大小操作时,它也同样是错误的(基本上与此Anchor
一样)。
我猜这可能与 Windows 窗体中的初始化序列顺序有关。我也发现了一些相关的问题:控制锚点当表单开始最大化时,属性不起作用。
有人知道处理这种行为的优雅方法吗?
In a .NET 4.0 Windows Forms application, I have a SplitPanel
with a multi-line TextBox
(with Anchor
set toTop, Bottom, Left, Right
) in its first panel. Distance to each border are maintained perfectly if I move the splitter in either the Designer or running application.
The SplitterDistance
property is bound to a user scope setting.
However, this does not work if the SplitterDistance
's value is modified independently and the application is restarted or the designer is reloaded. The distance in question is wrong on reload or startup, but it is kept equally wrong over further resize operations (as it should with this Anchor
basically).
I guess this may have something to do with the initialization sequence order in Windows Forms. I found sort of a related issue on SO as well: Control anchor property not working when form starts maximized.
Does anybody know an elegant way to handle this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论