开发者

Anchor of Control in SplitPanel not working with User Settings

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

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开发者_Python百科 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?

0

精彩评论

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

关注公众号