.NET C # drawing slowly

I have a problem in doing something quickly in .NET. I donโ€™t think that something in particular should take a lot of time, but on every machine I tried, I get serious problems. This is implemented in vs2008.NET using C # (with some materials in C ++, but nothing related to the drawing).

I have three screens, and the user should be able to switch between them without delay. On the first screen, there are four buttons, eight user controls, consisting of two buttons and 6 labels, a text field and a drop-down list. I donโ€™t think so much.

On the second screen, I have four shortcuts, six buttons and two controls that have six buttons, one opengl drawing context and about ten shortcuts each.

On the third screen, I have one opengl context and 10 buttons.

Switching from any screen to any screen takes literally about a second. For example, if I flip from the second screen to the first, the entire application will close, showing a background screen, and then the first screen will be drawn. Many times the screen loomed in parts, as if the machine was intentionally made from thin and tasty letters in a factory in Sweden, and then sent each separately to my screen. I exaggerate, and I want to make it clear, because I donโ€™t think the Swedes are as slow as this redrawing.

The first and second screens are displayed in memory and saved there, only with ".Hide ()" and ".Show ()" so that they appear and disappear. Double buffering does not seem to matter. The third screen is drawn again each time and it seems to take the same amount of time to draw both the first and second.

Any thoughts? What could go on? How can I track it?

Thanks!

Edit: I have to add that any C ++ processing and the like happens on its own thread. Sometimes EventInvoke displays the results of the operation on the screen, but this problem occurs without calling any functions, just by pressing buttons to move from one screen to another.

+6
performance c # drawing
source share
4 answers

In addition to the profiler mentioned, you can also disable OpenGL contexts. If you notice acceleration, then you will know this with your graphic materials, and you can focus your optimizations accordingly.

Points awarded for Swedish humor.

+1
source share

How can I track it?

dotTrace - http://www.jetbrains.com/profiler/

+1
source share

Do you perform any other processing during the "flip" event? besides just needing to rewrite the form? If you process something between flips (maybe your c ++ addition?), And you are not multithreaded, you get this white effect. The form is probably waiting for the processor time to redraw.

0
source share

I have never used OpenGL in this way, but you might want to take a look at how OpenGL contexts are turned upside down. When switching from one page to another, you may receive a reset device (in DirectX terms), which may cause a delay.

If at all possible, the device will select the opposite System.Drawing.Bitmap and use this bitmap on the screens. Make your OpenGL code aware of the current page where the user is on, and can get accelerated search speed.

To test this, before making huge changes, try deleting open OpenGL files in your form.

This is all a whim.

0
source share

All Articles