I have a zoomable form-interface like MS Word. The form contains +70 controls (Richtextbox, checkbox, etc) that are positioned all over the form.
The problem is that generating the form takes 2.5 seconds. Adding the 70 controls with panel.Controls.Add( ctrl) alone takes 1 second. (16 ms per call).
Is there a way to cache the whole blank form ?
Perhaps someone smart knows another method to generate the form ?
Are these controls being added through the designer, or are you adding them manually in code? If it’s the latter, I would recommend calling
SuspendLayouton theFormbefore you load the controls, thenResumeLayout(true)after you’re finished loading.Additionally, if these controls are being added while the form is visible, then suspending and resuming drawing can be a great help. See the accepted answer to this question for more info on how to do that.
EDIT
Why do you need 70
RichTextBoxcontrols? Have you considered redesigning the form so that so many aren’t required (reusing some for multiple purposes, for instance)? Have you investigated your custom control to see if any speed can be gained in your own constructor?