0

I have mdi forms which takes long time to load and thus bring a lot of flickering to the screen. In order to prevent flickering i used the sendmessage API as described here How do I suspend painting for a control and its children?. We suspend painting of the main form of the app.

Doing this works fine except than we encountered various strange behaviours:

  • If the user have a windows explorer instance behind, and he moves the mouse during the freeze, some parts of the left window of windows explorer begins to show up on the screen.
  • Sometimes if the user click the mouse during paint freeze, our app looses the focus.

Is it because we freeze the main form ?

How could we prevent any drawing while loading our mdi form without any side effects?

Community
  • 1
  • 1
FIF
  • 223
  • 1
  • 2
  • 6

1 Answers1

0

Suspend/Resume is great in many cases.

However for the loading of a form I prefer to let drawing continue as normal but hide the form using Transparency until it is completely loaded.

Form f = new Form { Opacity = 0.01 };
f.Show();
f.BeginInvoke( new Action(() => f.Opacity = 0.99 ));
John Arlen
  • 6,539
  • 2
  • 33
  • 42
  • Thanks. But unfortunately I need to freeze the painting of the main form while adding mdi forms. Changing the opacity to the mdi form does not seem to resolve the issue. – FIF Oct 09 '12 at 13:35