I'm creating a multiple form GUI app using a scene-manager to set the current visible form.
There isn't an issue regarding it working, that's fine. What I am noticing is that when each form is set to be active/visible, it takes a few seconds to load each component, and looks horrid. This is potentially for a business related endeavor, so I'm looking for a way to buffer the form so it loads fully before it is displayed.
I'm not sure if this is an issue with the use of a scene-manager, or it is something that is consistent across all C# form applications.
I've done a few google searches relating to this, but there was little aside from using "hide()" until it was loaded. That doesn't really work.
if you are referring to the controls on the form, suspend and resume layout methods of the forms class tells the form not to bother painting the controls until its finished creating them, but I don't know about this scene manager you speak of, so it may not support suspendlayout or resumelayout.
Create a new windows forms application project in visual studio and then drag some buttons onto the form from the tool box, then in the solution expand the item for Form1 and open Form1.Designer.cs notice that in the initializecomponents method defined there that before any controls are added this.suspendLayout() is called. Then after each control is added this.resumeLayout() is called. This prevents the display from acting crazy until all the controls are successfully added.
>>There isn't an issue regarding it working, that's fine. What I am noticing is that when each form is set to be active/visible, it takes a few seconds to load each component, and looks horrid. This is potentially for a business related endeavor, so I'm looking for a way to buffer the form so it loads fully before it is displayed.
Using hide until it is loaded won't really work. When you "make a form visible" or "make a control visible" it will fire the Load event for that control/form. It uses a delayed initialization, I forget the MS terminology for it. This way the application doesn't expense creating controls that will never show.
That being said what Diamonddrake told you is true. The designer should stop controls from showing until everything is ready to render with ISupportInitialize.BeginInit() . I can't think of a scenario like this and I have forms withs lots of controls.
Perhaps you could upload a demo project demonstrating this behavior?
if you are referring to the controls on the form, suspend and resume layout methods of the forms class tells the form not to bother painting the controls until its finished creating them, but I don't know about this scene manager you speak of, so it may not support suspendlayout or resumelayout.
Create a new windows forms application project in visual studio and then drag some buttons onto the form from the tool box, then in the solution expand the item for Form1 and open Form1.Designer.cs notice that in the initializecomponents method defined there that before any controls are added this.suspendLayout() is called. Then after each control is added this.resumeLayout() is called. This prevents the display from acting crazy until all the controls are successfully added.
Hope this helps.
Thanks for the post, forms are still created in the usual way, I've made not change to the automated form creation, so suspend/resume aer still there.
That being said what Diamonddrake told you is true. The designer should stop controls from showing until everything is ready to render with ISupportInitialize.BeginInit() . I can't think of a scenario like this and I have forms withs lots of controls.
Perhaps you could upload a demo project demonstrating this behavior?
Sure. I'm not sure what I've done, but it seems to have been quashed somewhat. The forms load faster, but there's still a flicker.
I think it was originally something to do with the images I was using as buttons, they were PNGs. it seemed like they were loading after the form as already displayed. It's still happening, but it's much quicker now.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.