Redraws and flickering

P

paulo

Hi,

I'm having some trouble with our .NET 2.0 Windows Forms application
regarding screen transitions. Suppose we have a form with some big and
crowded user control on it. Then we free this control and load another
one of the same size. This process causes a lot of flicker and redraw on
the screen. I've tried everything, including DoubleBuffering, and the I
solution I have is to put a panel in front of everything with the first
usercontrol image inside. Then free it and load the other one, catch the
new usercontrol image, put it on the panel, and finally freeing the
panel. This makes a much nicer and smoother transition, but it's still
not perfect.
Is there any way to stop any drawing on the form, create the new
usercontrol and free the old one, and then make the form draw everything
inside it on one transaction? I've done this in Win32 application and
the transition was just perfect. However, in .NET I'm still trying. Is
this still possible with .NET?
Thanks.

Regards,
paulo
 
L

Linda Liu [MSFT]

Hi Paulo,

Thank you for posting.

You may have a try calling the SuspendLayout() method of the form before
creating a new usercontrol and freeing the old one. After all these changes
are done, you may
call the ResumeLayout() method of the form.

Control.SuspendLayout method temporarily suspends the layout logic for the
control and the layout logic of the control is suspended until the
ResumeLayout method is called.

Hope this is helpful to you.
If you have any concerns or need anything else, please don't hesitate to
let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================
 
P

paulo

Hi Linda,

Thank you for your reply.
Unfortunately, I had already tried that approach without success. The
redraws are intense, causing much flicker.
Is there any other possibility?
Thanks.

Regards,
paulo
 
M

Marc Gravell

This might sound a daft question, so don't attack me if it seems obvious (it
isn't always)...

Are you running a: in debug mode, and / or b: in the IDE? Both of these
(often the latter more than the former) can contribute to the perception of
lousy performance in areas such as redraw (and exceptions etc), but in
reality the release code running outside of the IDE is fine.

Marc
 
P

paulo

Hi Marc,

No problem. You're trying to help. I would never attack someone trying
to help me!
We periodically run our application outside the IDE in release mode for
testing, and the problem is always there. Sure, there is a noticeable
improvement in performance, but not that much. That's why we've tried
other approaches to the problem, and we have it close to perfect using
the method I described in my first post, but in Win32 we had perfect
transitions between application screeens. Probably, we're being to picky
with this, but we are releasing a new version of our software in .NET
2.0 and customers will notice this difference, for sure.
Anyway, thank you for your advice. Sometimes we overlook the simplest
things.

Regards,
paulo
 
G

Geoff Munday

paulo,

Are you using any third party controls (Infragistics, XCeed, etc.) in
your UserControls?

Additionally, it is not enough to call suspend layout on just the Form,
the Panel, or the UserControl. Take a look at this posting from
Jessica on the Windows Forms team at Microsoft regarding
SuspendLayout() and ResumeLayout() - I believe it will be very helpful
to your cause.

http://blogs.msdn.com/jfoscoding/archive/2005/03/04/385625.aspx

Regards,

Geoff
http://nonspect.com
 
J

Jeffrey Tan[MSFT]

Hi Scott,

Thanks for your feedback!

Without reproducing out the problem, it is hard for us to hit the root
cause at once. Currently, I recommend you give the following article a
read. This article is the definite .Net Winform performance issue article
writen by Microsoft .Net Winform developer:
"Practical Tips For Boosting The Performance Of Windows Forms Apps"
http://msdn.microsoft.com/msdnmag/issues/06/03/WindowsFormsPerformance/

With applying the suggestions in this article, you can achieve the best
performance in .Net winform. Hope it helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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