问题
I have added a SplitContainer inside another SplitContainer's Panel. Everything redraws fine when the splitters move. But resize of inner SplitContainer doesn't work correctly if the main SplitConainer's size changed by the main form's maximize/restore buttons.
If I move the splitter it redraws everything fine. I tried Invalidating everything in each SplitPanel SizeChanged event, but no luck. Do you have any idea?
回答1:
I think this is the cause. The issue was gone after simplifying the complex layout into several simple layouts.
http://social.msdn.microsoft.com/forums/en-US/windowsuidevelopment/thread/25181bd5-394d-4b94-a6ef-06e3e4287527/
A little investigation showed that Windows stops sending WM_SIZE when it reaches some certain nesting level. In other words, it won't send WM_SIZE to your child windows if you try to resize them when you process WM_SIZE in the parent ones. Depending on the USER stuff/updates/serivice packs the maximum nesting level at which it stops propagating WM_SIZE may vary from 15 to 31 and even much higher (effectively unreachable) under latest XP 32bit/sp2. But it still too little under XP x64 and still some similar ugly things happen to other messages under some builds of Vista.
So it is certainly a Windows bug.
来源:https://stackoverflow.com/questions/6644213/winform-splitcontainers-redraw-issue