Anchor of Control in SplitPanel not working with User Settings
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?
精彩评论