StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Slow drawing formsExpand / Collapse
Author
Message
Posted 03/01/2007 9:07:05 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 04/11/2007 8:30:06 AM
Posts: 99, Visits: 253
Has anyone come up with a solution to this issue?  I have seen this on the simplist of forms (20-30 controls).  You can watch the forms draw.  Sometimes taking 4-5 seconds.  I know .NET needs to compile it the first time when run so I reran the form and it after the initial compile.  Same results.

I have tried adding Me.SuspendLayout() prior to enabling/disabling controls (buttons with graphics seem to flicker when you Disable/Enable them), then .ResumeLayout after my settings.  I have tried turning on DoubleBuffering which seemed to do nothing.

I do not have the fastest machine or best graphics card available.  I use other development environments that compile to Win32 code and do not exhibit this behavior.  Yes I know .NET is compiled/optimized at runtime, but once compiled I would expect it to perform at the same level as a native Win32 generate application.

Am I expecting too much from .NET?

Ben

Post #7230
Posted 03/01/2007 9:12:21 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 08/01/2008 8:53:41 AM
Posts: 2,671, Visits: 1,879
No, with only 20-30 controls on the form, it should initialize and render much faster than 4-5 seconds.  Most likely, something else is causing a problem.  The SecurityDialog in the RBS has something like 60 controls on it. 

If you need to analyze the problem, I would recommend ANTS from Red-Gate software.  You can download their trial, which runs for 14 days.  Profile your application, and it will tell you how much time each line of code took when it ran.  That might give you a clue as to what is chewing up 4+ seconds in your form's loading.


www.bungie.net
Post #7231
Posted 07/25/2007 4:18:52 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 08/02/2007 11:33:25 AM
Posts: 26, Visits: 1,038
I have a related question.  My machine is probably slightly better equipped than what my customer base uses.  My specs are 1GB RAM and 128MB VRAM.  I have an MDI child form that was created from the StrataFrame Maintenance template.  Because I want to utilize themes, I dropped themed panel onto the background of the form.  On top of that, I dropped a SF TabControl to which I added two pages.  On each page of the TabControl I dropped a themed panel.  On the themed panel for the first tab page, I added 64 label controls (half SF and half Windows standard), a SF themed GroupBox, a SF RadioButtonGroup with three radio buttons and a SF button.  This gives me a total of less than 80 controls that I added to the form. 

In Design Mode, before I even linked anything to a BO, the tab page that has all of the controls on it drew slowly in (about a second but definitly able to visibly see the controls drawing, especially the labels).  If I click the 2nd tab page and back to the 1st it redraws slowly.  If I put another window on top of the VS IDE, the form draws slowly when I close or move the other window.

At run time, I received the same results.

I've tried different approaches to speed this up.  1) I placed all of the UI controls on a SF Standard Form with no panels or tabs (faster, but still visible).  2) All of the UI controls replaced by standard windows controls, placed on a standard windows form (about the same as #1).  3) All of the SF labels on the original form replaced with SF Text boxes (still slow).  All of these forms draw faster at run time if they are launched as standalone instead of MDI children.

Is there anything out of the ordinary that I've mentioned (about my system or what I'm doing) that might cause such a slow rendering of forms in both design mode and at run time?

TIA.

Post #10566
Posted 07/26/2007 9:18:24 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 08/01/2008 8:53:41 AM
Posts: 2,671, Visits: 1,879
There are a couple of options we've done that help drawing stuff like that.

1) Setting DoubleBuffered = True on the parent form.  This will cause all of the drawing to be done on a buffer and then painted to the screen to help reduce flickering.

2) Research into the LockWindow() method of the User32.dll (it's a windows API call).  You can make the IP call by passing the .Handle of the parent form and it will prevent the entire form from painting.  Then, when you know that all of the controls are visible, you can call the LockWindow() again and pass IntPtr.Zero to unlock the window and all of the controls will paint at the same time.


www.bungie.net
Post #10572
Posted 07/26/2007 9:35:13 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 08/02/2007 11:33:25 AM
Posts: 26, Visits: 1,038
Thanks for the advice Ben, I'll give those methods a shot and see if that helps.  It might not help much since they are also slow drawing during design time, but at least maybe I can delay showing the form until everything is in place.
Post #10577
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 8:36pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.094. 9 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.