Currently I have a code that refreshes some MdiCildren screens, the fact is that when doing this it visually looks a bit ugly until it ends, so I need to know if it is possible and how to make it not paint anything on the screen until a point is reached and refresh the screen at that time
mixing code and pseudocode would be something like this
noRefrescar();
foreach( Form f in this.MdiChildren)
{
f.WindowState = FormWindowState.Maximized;
}
Refrescar();
Thanks.
In the C# documentation you can see the methods
SuspendLayout
andResumeLayout
that they do just what you need:There are other ways, using
Workers
other threads that send you aready
when what you need to detect has finished, but for your specific case, so much complication is not necessary.SuspendLayout
You could use the and methodsResumeLayout
, but in case they don't work you could implement these two methods:You can implement it in the following way:
NOTE: For no reason should you forget to call the method
ResumeDrawing
, this way you could avoid any drawing problem of the object.