0

I've got a PropertyGrid displaying an object, one of whose fields is a System.Drawing.Color. This makes the field on the PG automatically display a color, and if you click to edit it, you get a nice drop-down, showing custom colors, system colors, etc. Problem is, this drop-down takes about 10-30 seconds to draw - the custom colors one is especially bad. I've tried setting double-buffering on the PG to hide the slowness, but that just makes it pause while it draws before displaying, no improvement in speed. Is there any reason why this particular feature should be so slow when everything else is running perfectly fine?

I am running this program alongside another which it communicates with, and that program uses a 3D rendering engine which is admittedly kind of processor-heavy, but it's not so bad most of the time. The only thing that's unbearably slow right now is that color drop-down. Can't imagine what could be causing it.

Darrel Hoffman
  • 4,436
  • 6
  • 29
  • 41
  • Is is that slow when you run the program on a computer that isn't running the 3D program? Nobody can probably answer this question unless you post code that reproduces the problem. – LarsTech May 25 '12 at 20:08
  • It'd be difficult to test - the color in question corresponds to lights in the 3D scene, so without the 3D program running, it would have no data to work with. Unfortunately, I don't think I could post enough of the code to be of use without posting the entire program (including the 3D project), and that would be huge. The color-thing is automatic, though, using standard system classes, rather than something I wrote. Just wondering if there's maybe some way to double buffer the color dialog itself and not just the PropertyGrid. – Darrel Hoffman May 25 '12 at 20:26
  • It sounds like your class with the color property isn't just reporting a color value, it's "fetching" the color from the 3d project — that could be time consuming. Ignore the PropertyGrid control, just instantiate the class that the PropertyGrid uses and get the Color property in question and profile it - how long does it take to get the color? – LarsTech May 25 '12 at 20:34
  • Sorry, no. The data is all fetched once at the beginning of the program, not called when needed. Ultimately, it'll get sent back to the 3D program when you change stuff, but that's not implemented yet. No data is pulled from the 3D scene after the initial setup. (Well, one thing is, but it's not relevant.) Anyhow, it's not the getting of the color that's slow. It's literally taking that long just to draw the drop-down list. You can watch it slowly draw each box one by one. I'm certain it's a GUI issue rather than a data issue. – Darrel Hoffman May 25 '12 at 20:51
  • Once the data is fetched, close the 3D program, then try to show the color property. See if there is any difference. – LarsTech May 25 '12 at 21:02
  • You can also try to change the process priority (from Task Manager) for both processes so that your UI gets higher priority. At least to verify that the problem is the other program hogging the CPU – Tergiver May 25 '12 at 21:41
  • Might be able to do the latter - but the client is designed to log-off as soon as the 3D program is closed. Would take some monkeying to turn off that feature. We have tested the program when the client and 3D program are running on different machines. (It communicates via TCP, usually localhost, but can be configured over a network.) In this scenario, the client runs much faster, but this is not the generally expected use-case. Most of the time they will need to be run on the same machine. – Darrel Hoffman May 27 '12 at 22:58

0 Answers0