Redraw and flicker issues

Posted by AngryHacker on Stack Overflow See other posts from Stack Overflow or by AngryHacker
Published on 2010-03-29T21:53:54Z Indexed on 2010/03/29 22:03 UTC
Read the original article Hit count: 434

I have an Outlook style app. So basically I have a sidebar on the left and on the right I have a panel control (pnlMainBody) that hosts content.

The content is typically a user control that I add to the panel when user clicks appropriate button in the side bar. The way I add the user control to the panel is as follows:

// _pnlEmails is the User Control that I am adding to the panel
_pnlEmails = new pnlEmails();
_pnlEmails.Dock = DockStyle.Fill;
this.pnlMainBody.Controls.Add(_pnlEmails);

Some of the user controls that I add to the main panel are quite complex UI-wise. So when this.pnlMainBody.Controls.Add(_pnlEmails); fires, I see the control appear on the screen, then it resizes itself to fill the body of the panel control.

It's quite ugly actually, so I was wondering whether there is a way to not show the resizing until it's actually done resizing?

I've tried setting the user control's .Visible to false. I've tried doing .SuspendLayout, all to no avail.

Is there a way to do this so the screen transitions are smooth?

© Stack Overflow or respective owner

Related posts about winforms

Related posts about .net-2.0