Showing a Form quickly
-
Hi all, I have a form which is "heavy" , it have some pics and rich texts and stuff. when i run the code "this.Show()" to display it starts drawing the form and the user can see the parts of the form being built. i try to created it long time before showing it it still dont work. the form is Borderless and it have a big picture on him with transperent color. any ideas how to show it quick? Ran. R.Z
-
Hi all, I have a form which is "heavy" , it have some pics and rich texts and stuff. when i run the code "this.Show()" to display it starts drawing the form and the user can see the parts of the form being built. i try to created it long time before showing it it still dont work. the form is Borderless and it have a big picture on him with transperent color. any ideas how to show it quick? Ran. R.Z
There's usually no way to speed things up. Most people who have "heavy" forms are using 100's++ of controls and don't realize that creating a control is an expensive operation. Drawing all of them is also not cheap. The form is not compiled into an .EXE prebuilt with all the controls in place, ready to go. They are created added to the form's Controls collection when the instance of the form is created (calling the its constructor) and the constructor calls the form's InitializeComponents method. I think the next most common problem is using images that are FAR bigger than they need to be for displaying at a normal resolution. For example, loading a 2,000x2,000 pixel image at 32bbp into a PictureBox that is only sized to 200x200. That's 10 times the image detail being put in a box that will never show it. Reduce the image size, if at all possible, to what is actually going to be shown. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
There's usually no way to speed things up. Most people who have "heavy" forms are using 100's++ of controls and don't realize that creating a control is an expensive operation. Drawing all of them is also not cheap. The form is not compiled into an .EXE prebuilt with all the controls in place, ready to go. They are created added to the form's Controls collection when the instance of the form is created (calling the its constructor) and the constructor calls the form's InitializeComponents method. I think the next most common problem is using images that are FAR bigger than they need to be for displaying at a normal resolution. For example, loading a 2,000x2,000 pixel image at 32bbp into a PictureBox that is only sized to 200x200. That's 10 times the image detail being put in a box that will never show it. Reduce the image size, if at all possible, to what is actually going to be shown. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
hi well that aint the case. i do not have over resolution at all. i am using 3 smallpics and 1 piger one and another picture which is all over the form. but the resolution is normal and i create it long time before showing it. isnt there some way to tell him to praper the form as picture or something and show it all together..? Ran. R.Z
-
hi well that aint the case. i do not have over resolution at all. i am using 3 smallpics and 1 piger one and another picture which is all over the form. but the resolution is normal and i create it long time before showing it. isnt there some way to tell him to praper the form as picture or something and show it all together..? Ran. R.Z
Nope. You'd be going through the same problem just to get a snapshot of the form. You'd also have to wait until the thing draw the REAL form to get usable controls. If you're only using a few controls and pics, then what's taking so long? Perhaps a code profile would be in order. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome