Font and Color Dialogs intermittently take an exceptionally long time to display on certain user machines.  Any idea why?  I cannot reproduce locally.

Posted on 2004-08-31
Last Modified: 2013-12-03
I have a charting application that has many users.  Why viewing a chart, they can right-click and choose the preferences option to launch another form that is shown modally to modify the parameters of the chart.  On this new form there are many buttons for modifying the colors and fonts of the chart.  When they click on one of these buttons, I simply show a Color(or Font) Dialog with simple code:

ColorDialog dlg  = new ColorDialog();
dlg.Color = (Some Default Color);
Color result = dlg.Color;

A user called this morning and said it was taking between 6-10 minutes for the dialogs to reveal themselves.  The moment he clicked the button to launch the above code he was no longer able to touch any of the charts, receiving a beep in complaint, as though the Color dialog was visible (shown modally).  He simply had to wait it out and respond to the dialog.  He also said he received similar delays with the Font dialog.  Again, it is only 'some' users and only 'some' times.  This user does not always experience this issue.

Any ideas would be helpful, I dont see anything I can change.


The same user has informed me that even MessageBox dialogs are taking extended amounts of time to display.

Question by:ericdotnet
  • 3
  • 2

Accepted Solution

petoskey-001 earned 500 total points
ID: 11983373
It sounds like the disk is thrashing.  On computers with not enough ram, windows will swap out the currently running memory to the hard drive and then bring it back from the hard drive to real memory.  It does this transparently so programs don't notice, but users sure do.  I would suggest your client buy more ram.

As far as your code, it's late so I can't think right now what you would check.  

Expert Comment

ID: 11983374
oh Yeah, is it limited to just your program?  My guess is it happens to most programs of similar size, or when running several applications on his computer.

Author Comment

ID: 11984444
It is just my program, but the program _does_ take huge amounts of ram - half a gig or so (it pulls market data from many financial exchanges).  I'll have him upgrade his ram and see if that resolves it.

Author Comment

ID: 12146448
petoskey-001, you had it right.  It turns out that GDI+ objects are not truly managed objects and they need to be explicitely disposed of.  I was not doing this and they were eating up all of the systems ram and filling up the page files, hence the slow dialogs.  Thanks for helping me find the bug! :)

Expert Comment

ID: 12147002
Ah, The wonders of C#.  It's a nice language, but to do anything low level or you end up falling back on your C skills.  Glad to hear you found the problem.  

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question