Slow Form Controls Drawing

O

Oliver S.

Hi together,

my first test with C#.NET (MS Visual Studio 2003; .NET 1.1) was very
disappointing...

The display of a dialog looks like in former days... so slow!
Yes I know the JIT compiler ... but this is not the problem (it occurs even
if you display the dialog more than once).
The display process of painting the controls is very slow (even with a 2Mhz
PC)!
I searched the whole newsgroups and can't find any other user who has this
problem... and this I can't understand.
I tried it meanwhile on 3 different PCs (all about 2 MHz and about 512 MB).

Here my (very simple) scenario:

a. I simply created a new C# windows application and defined the main form
as MDI container.
b. I added a main menu which contains one option for displaying a dialog
form.
c. I created the dialog form and put only 5 controls on this form (one group
box and 4 textboxes).
This means no special overloaded user controls!
d. So now let's start this "big" application.

I select the menu option and the dialog appears (ok...)
But if you look how the form will be displayed you can see that first of all
the form will be drawn, and at all
locations where the controls will be displayed, a rectangle with the (dark
gray) background color of the MDI form
is shown through. After this the controls are drawn. Ok, this goes fast but
nevertheless you see these dark gray rectangles for
a short time and this looks very unprofessionel... If you rebuild this
scenario with former C++ or VB6 applications, it's not the case.

First I thought there are different window styles for .NET forms defined
(e.g. difference with WS_CLIPCHILDREN or WS_CLIPSIBLINGS) but the "Spy" tool
shows me the same settings... This means there must be different
implementation for erasing the background or drawing the controls?????

Is there no .NET developer which is annoyed by this behaviour???

Thanks for all comments or hints about this topic!

Oliver
 
O

Oliver S.

Hi together,

I just found one more hint:

If I set the property "FlatStyle" of the "GroupBox" from "Default" to
"System", it works correct!
But the textboxes are still slow...
I just added a checkbox, but it behavious also slow if I add its property to
"System"...

Any hints?
 
O

Oliver Söhnges

Puhhhh.....

I found the solution, but can someone tell me the reson for this?

The problem is the property "StartupPosition" of the form.
I had defined it with "CenterScreen". If I change it to
"DefaultWindowsLocation", it works as expected!
("CenterParent" has the same "slow" effect).

Why ... ????

(I don't want to set "DefaultWindowsLocation" for dialogs :( )

The best control for seeing the effect is a checkbox which should be sized
to nearly the whole dialog!
(and textboxes).

Best regards,
Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top