Optimization of 2D drawing in Visual studio.NET? [default driver] [different colors]

admin / September 17th, 2010/ Posted in Software / No Comments »

Q: If I, or someone at work creating one. NET GUI with text and buttons and even worse, colors and sliders, the gui is slowly drawn. It is no exaggeration, perhaps one second or so. That could IE browse and see if you remove your graphics drivers and execute the standard Windows driver.

If I take some other window and dragging it over the gui, I actually erase the window. It is white or empty until it redraws it.

If I have the gui flash as an indicator or a slider somewhere is it just as the flashing does not flash, but redefines the color from one side to the other and to scroll, I have to move and wait until I see the drawn picture.

There are no problems with other programs and I am ATI / NVIDIA graphics cards in recent drivers.

Is something or to optimize the design somewhat to normal?

Thanks


Re:There is a new answer. Its just the nature of the best (software rendering). You can do little tricks with software rendering but there are gotchas with that but ms has a new way to do things. Try XAML. Everything with XAML used your video card to render everything. THere is one downfall of this. Its a realitively new technology and its not NEARLY as simple as windows forms.

Re:I am quite new to visual studio. I use the basic libraries and forms for my GUIs, for events I just use the .NET handler, I don't really know how to be more specific.

Re:The WM_PAINT handler is the low level Windows API. when using the .NET and forms; you will never normally see or get near that code.

Is this only on one system or for all your developmental systems.
Have you tried to duplicate it using the VS Express?

Depending on your complexity of the screen, the video driver should not come into play at all.


Re:I've drawn pretty complex GUIs using C#, and only slowdown happens when I have additional processing that is not in separate thread. Do you have any polling? How do you handle the events?

Re:Originally posted by: guy

Originally posted by: guy
If I, or anybody at work creates a .NET GUI with text and buttons and even worse, colors and scroll bars, the gui is drawn slowly. It is not excessive, maybe a second or so. Something like IE would scroll and look if you uninstall your graphics drivers and run of the Windows .

If I take some other window and drag it over the gui, I basically erase the window. It becomes white or blank until it redraws it.

If I have the gui flash as an indicator or have a scroll bar somewhere it is really bad as the flashing doesn't flash but redraws the color from one side to the other and to scroll I have to move and wait until I see the drawn picture.

There are no problems with other program and I have good ATI/NVIDIA graphics cards with recent drivers.

Is there any optimization or something to make the drawing somewhat normal?

Thanks
It sounds like you have additional work that is being done behind the scenes that is taking up a lot of the CPU time for the program.

The applicaiton is not getting the proper time slicing to complete the WM_PAINT handler for the application and/or the drawing objects. If you have customized objects, one may be affecting the drawing.

Also, coiuld you be loading up information in the WM_PAINT handler that does not need to be loaded each time?

I don't think that is it. CPU usage is quite low (under 10 %) all the time except when maybe first running the program.

Also, if I create only a GUI with no underlying logic, it still draws just as slow.

How can I check the WM_PAINT handler or maybe find more detailed information about it?

Could there be something like video driver interface that I can load so VS uses the graphics drivers?

Thanks

Edit, I am using the .NET forms to create the GUIs if that's what you meant.

Also it is version 2005.


Re:Are these Windows Forms applications?

MSDN magazine has had a few articles on optimizing, try a search of MSDN.microsoft.com (or google since MS search is weak) on something like "optimize windows forms" (also try "optimizing windows forms").

We're still a VS6 / MFC / Win32 shop at work so I can't offer any personal tips.


Re:Originally posted by: guy
If I, or anybody at work creates a .NET GUI with text and buttons and even worse, colors and scroll bars, the gui is drawn slowly. It is not excessive, maybe a second or so. Something like IE would scroll and look if you uninstall your graphics drivers and run of the Windows .

If I take some other window and drag it over the gui, I basically erase the window. It becomes white or blank until it redraws it.

If I have the gui flash as an indicator or have a scroll bar somewhere it is really bad as the flashing doesn't flash but redraws the color from one side to the other and to scroll I have to move and wait until I see the drawn picture.

There are no problems with other program and I have good ATI/NVIDIA graphics cards with recent drivers.

Is there any optimization or something to make the drawing somewhat normal?

Thanks
It sounds like you have additional work that is being done behind the scenes that is taking up a lot of the CPU time for the program.

The applicaiton is not getting the proper time slicing to complete the WM_PAINT handler for the application and/or the drawing objects. If you have customized objects, one may be affecting the drawing.

Also, coiuld you be loading up information in the WM_PAINT handler that does not need to be loaded each time?


Related posts


Tags: ,

Leave a Reply

Name required

Mail (will not be published) required

Website