rajkumaradass rajkumaradass - 1 year ago 55
C# Question

C# form upon activating when in minimized state shows incomplete form for few seconds

We have a c# form UI issue, when it is minimized state. There are few controls inside the form and the app is brought to normal state from minimized state from a different form - during this transition phase, the UI appears incomplete Incomplete built form UI for 2-3 seconds and is clearly noticeable one.

we are using .Activate(); to bring this to normal state. Where we see black squares are all different controls present in the form. Is there way to avoid this incomplete UI until a complete one is built? Appreciate your suggestions.

Answer Source

Declare the following property in your form -

protected override CreateParams CreateParams
       CreateParams objCreateParams = base.CreateParams;
       objCreateParams .ExStyle = 0x02000000;
       return objCreateParams ;

Using this property, the painting of your controls remains invisible, and will display once it is done with drawing the controls.