Layout takes time to rearrange after rezise, how to fix?
-
Hi, on My form I have about 150 controls at the same time, and most of them use docking. some of them are childs in childs in childs of controls. Whenever I resize my form it takes a long time for it to rearrange and ready to workwith. I manged to speed up things in the proccess of adding all the controls by using ResumeLayout and SuspandLayout. But what should I do in the proccess of resizing? How can I find out when the resizing event startend and when the resizing is finished? tnx leeoz
-
Hi, on My form I have about 150 controls at the same time, and most of them use docking. some of them are childs in childs in childs of controls. Whenever I resize my form it takes a long time for it to rearrange and ready to workwith. I manged to speed up things in the proccess of adding all the controls by using ResumeLayout and SuspandLayout. But what should I do in the proccess of resizing? How can I find out when the resizing event startend and when the resizing is finished? tnx leeoz
Resize event doesn't quite work like that, it gets fired when the forms size has changed. So when you resize your form with your mouse, every time you see a visible change in the size of your form, then event has been fired. Sadly you can't get the mouseDown mouseUp events for clicking on the border. The only way i know to get that information is to override WndProc and look at the messages, one of them is sent when you mouse down on the caption bar/border and other are sent when the mouse moves or the button is released. But, i tried using SuspendLayout and ResumeLayout with docked controls, and i think after ResumeLayout the controls just stayed where they were. So you should check that. Good news is though, if you also override the OnPaint event you can stop any drawing yourself. So if you use WndProc to work out when the form is being resized then you can set a bool to false or something, and have an
if
statement aroundbase.OnPaint(e);
in your OnPaint override. Of course even without drawing it will still try to reposition all of the controls every time the resize event is fired, so it may still end up going slow. Well, good luck.My current favourite word is: Bacon!
-SK Genius