Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Why is VS 2003 Designer Mode so slow in loading some forms?
 

Why is VS 2003 Designer Mode so slow in loading some forms?

On my forms with many (50+) controls it takes many MINUTES to load the form in designer view. The problem is magnified with forms using UserControl derived formss. I'm using a more than adquate system too. Is there a fix or a workaround to address this or at least improve it because it really hinders rapid development when you have to wait minutes each time the designer needs to be re-loaded, which is basically every time the header file is modified.

Thank you for any advice!

(i am using managed c++)
GLutz78  Monday, January 30, 2006 4:38 PM
http://support.microsoft.com/kb/832138/en-us

THIS IS THE ANSWER!!!! FIXED THE PROBLEM.
GLutz78  Thursday, March 30, 2006 4:01 PM
I'm having this same problem, and it's making those of us at the office who do use .NET to pull our hair out.

Does anyone have an answer to our problem?
Georgia Nelson  Wednesday, February 15, 2006 1:59 PM
This is a total joke! I have had this post and several like it here for months now and no one from Microsoft offers any response. What is the point of these forums if i cant even get a response on a simple question like this? Even if it's just, "that's how it works - it's slow in this regard", at least that is a response. VS2003 is a great product so I assume there is a way to improve on this aspect of it. It's too bad the quality of support doesnt approach the quality of the development though.




GLutz78  Tuesday, February 21, 2006 7:54 PM

Perhaps the reason you are getting no response is that you have provided no information that would help someone in troubleshooting your situation.What operating system/service pack doyouhave? What are your hardware specs?How many controls do you have on your form? What types are they? Do you have custom controls, and what do they do? Are you using visual inheritance? How deep is your inheritance tree? How complex are the base forms compared to the derived forms? Are you doing custom painting? Do you have controls with image backgrounds? Have you tried disabling anti-virus software? Can you post a code sample, or a sample project that reproduces the problem?

This is a volunteer-driven forum. There are plenty of people on this forum who would be more than willing to help. However, most of us have our own full time jobs, and are not interested in wasting time shooting at your problem in the dark. To give yourself a better chance of a timely response, try providing as much information as you can up front.

CommonGenius.com  Wednesday, February 22, 2006 12:30 AM

These are all very good questions if you can answer them. Sorry for the slow response.

Another question is that once the form is displayed, is it faster to show it again in the designer? ie -- is it an issue loading your referenced assemblies from disk? If it is still slow, are you using a lot of nested containers that are doing layout?

Benjamin Wulfe - MS  Wednesday, February 22, 2006 2:06 AM
The controls on the form are derived from UserControls (Custom made controls). There are about 50 of them. In addition, to 5 panels (so yes, there are a few nested containers). These custom controls are just custom "buttons". They draw an outline, paint the background, draw some text and then an icon. So that is pretty involved i guess. They all do this by overriding the Paint event of the base control.

This is just an example of one form though. There are other forms I have that take very long to load too and have no custom controls at all - just hundreds of regular Windows controls. I believe that the UserControl derived controls are individually more expensive to load though. However, it's not like the issue is *limited* to these controls.

Every time i open the form it takes the same amt of time to load up. Even if i change something minor in the header, it re-loads. So this is not a 1 time overhead thing. It is a major slow down as the form is re-loaded often in the designer.

I am using VS2003. on WinXP sp2. Managed C++ .Net. So it is calling the InitializeComponent function each time it tries to load a form in the designer.

I understand that there may be nothing I can do about this but I appreciate any advice that could help even 20%.

Thank you
GLutz78  Wednesday, February 22, 2006 1:58 PM
i am guessing that there is a strong possibility that your custom painting for the controls is the problem here. you're saying that these are custom buttons? would you mind pasting some code particularly their rendering functionalities?

btw: InitializeComponent is not called, it is parsed at design time...
joeycalisay  Thursday, February 23, 2006 6:39 AM
I'm just shocked that this is not reported as a common problem. Just add a bunch of Windows controls to a form and it takes a while to load. Now the UserControl derived stuff is much slower b/c of the painting i guess, but there's not too much I can do about that since I have to paint the controls. It's just a bunch of DrawString, MeasureString, FillRectangle, DrawIcon calls. Nothing more than that.

QUESTION: Is there any way to remove some functions in the designer but have them put back at runtime?

Thanks
GLutz78  Thursday, February 23, 2006 10:01 PM

GLutz78 wrote:

I'm just shocked that this is not reported as a common problem. Just add a bunch of Windows controls to a form and it takes a while to load.

What does "a while" mean? Obviously, the more controls on a form, the longer the designer will take to open that form. But you're right: if this were a common problem, it would have been reported, and you would see lots of people complaining about it. Since you dont see that, its probably a safe bet that there is something specific about your scenario which is causing the slowdown.

You can use the DesignMode property of a control to determine whether you should take some action (such as painting) based on whether you are at design time or not. Have you examined your custom painting code to determine if it is fully optimized? Because a control might be repainted very often in certain scenarios, it is important that paint handlers be as fast as possible. Use caching and pre-calculation to minimize the amount of time your handler takes to execute.

CommonGenius.com  Thursday, February 23, 2006 10:27 PM
"A while" means over 1 minute to load the form in the designer. during this time VS is competely locked up. In the worst cases it takes maybe 3-5 minutes.

I'd be glad to post an example project somewhere so everyone can see it. Like I said, if you just add a bunch of Windows buttons/panels/lists to a form, the problem still happens, it's just worse with UserControls. Maybe if i wrote the user controls in win32 it would be faster.

Thanks for the advice though - i will see what i can optimize.
GLutz78  Friday, February 24, 2006 2:39 PM

Take a look at an article we published in improving performance at:

http://msdn.microsoft.com/msdnmag/issues/06/03/WindowsFormsPerformance/default.aspx

This may give you some ideas on improving perf in your scenarios. However, just adding some panels and buttons should not take a long time.

You can also trydisabling the "AutoToolboxService" (Tools->Options->WindowsForms/AutoToolboxPopulation) and see if that makes any difference.

Other than that, it may be unique to your machine. I would try to open your project on another machine with VS2005 installed if thats an option.

Benjamin Wulfe - MS  Friday, February 24, 2006 6:22 PM
After more research it seems that the problem is that I am working within a very large project (vcproj). By large, I mean 266 header, cpp, and resx files combined. Maybe more relevantly, it has about 75 forms. When i open my the header files in design mode in the scope of another project that has nothng else in it, the designer renders the screen about 80% faster than when i open the header while it is part of the large project.

Like I've said, forms with UserControls still open slower than forms with just windows controls but it seems that the real killer is if the form is part of a large project.

This problem is happening on every developer machine we have (which means 8 machines). They are XP.

Any ideas on what i can do to improve this based on this new information?

Thanks again.
GLutz78  Saturday, February 25, 2006 4:07 PM
I have a project with around 300 forms, and a number of formshave 50+ controls. Sometimes I have trouble getting them to open at all, because of other problems with the Windows Forms designer in VS 2005. But when they do open, it usually takes between 15 and 20 seconds for the form to fully open and be usable. So I dont think the size of your project is the direct source of the problem. However, most of that time is taken up by the toolbox auto-populating with our custom controls. From your description, its possible that you might be having a similar situation. Try opening the VS options, selecting the Windows Forms Designer, and setting AutoToolBoxPopulate to false.
CommonGenius  Saturday, February 25, 2006 8:53 PM
This does not appear to be an option in VS 2003, which is what i am using.
GLutz78  Sunday, February 26, 2006 4:27 PM
Sorry, I forgot you are in 2003. Back to the drawing board...
CommonGenius.com  Monday, February 27, 2006 12:49 AM

There may be some performance problems in VS2003 in solutions that contain many projects and references between them.

Can you enter the information about your project at:

http://lab.msdn.microsoft.com/ProductFeedback/

(create a product bug and add your sample project as an attachment)

Benjamin Wulfe - MS  Monday, March 06, 2006 3:29 AM
Step 3 only gives me the option to enter VS 2005 as the product version. Is there somewhere else i can log a bug for VS 2003?

Thanks.
GLutz78  Tuesday, March 07, 2006 9:22 PM

Hi, i have the same problems with the designer mode. i have found something older about a hotfix for VS2003

http://www.thescripts.com/forum/thread282571.html

this is the KB number : KB832138 but i couldnt find it.

And also some guys write:

"Hotfix for slow form GUI loading at Design View is decreased the loading
time. Before some of my forms were being loaded in 15-20minutes by using the
99% of the CPU, 60-80MB of 512MB RAM. After installing the hotfix, which is
called as VS7.1-KB832138-X86-unmerged-Enu, the loading time is 2-4 minutes by
using the the 90-98% of the CPU, 50-80MB of 512MB RAM.

The hotfix published in German and English. I don't know other packages in
different languages. The complete Service Package is thought to be published
in February 2005 by Microsoft. There are some other hotfixes on Microsoft web
page. In order to have those hotfixes, it is required to demand for each
separately at Microsoft Support (Web or phone).

Have nice days."

http://www.mcse.ms/archive108-2004-9-1053245.html

Anybody knows something about the hotfix?? thankss

serdarkarahisarli  Saturday, March 18, 2006 12:09 PM
http://support.microsoft.com/kb/832138/en-us

THIS IS THE ANSWER!!!! FIXED THE PROBLEM.
GLutz78  Thursday, March 30, 2006 4:01 PM
Quote:

"Sometimes I have trouble getting them to open at all, because of other problems with the Windows Forms designer in VS 2005."

Can you tell me specifically what bugs are in the forms designer for 2005? I am having a very hard time opening my forms 80% of the time. They do not have many controls. I consistently get type load errors, legal path errors, etc. This has brought by development to a near standstill simply because I can't open my forms! Please help!

Sincerely,
Ben


bensterdev  Friday, March 31, 2006 1:49 AM

You can use google to search for other answers

Custom Search

More Threads

• PropertyGrid.Site
• Form designer error - please HELP ME
• How do they make these kind of Interfaces?
• Global Assembly Cache (GAC)
• System.Windows.Forms won't load (VS can't seem to find it)
• UserControl with an ArrayList property raises an editor error.
• Windows Control in ASP.NET App
• child controls of custom control disappear at run-time
• Unable to locate license assembly and third party controls
• I can't add new data source in VC# 2008 design