TreeView flashing when resizing form - but only as a Dialog WHY?

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I've seen several posts from people who have seen this flashing in
TreeView's when resizing a form. I've noticed it in my app, but only in the
child windows. For example, my main form has a splitter with a TreeView and
I do not get the flickering with it.

I created a new Form based Windows app. Added a TreeView (dock left), then
a splitter and a property grid on the right (dock fill). For this test, I
added a panel and button at the bottom so I could create the child form.

I created a second form and created it the exact same way - TreeView on the
left, splitter and a property grid on the right. In the click handler for
the button on the first form, I create a new "Form2" and call "ShowDialog"
passing "this" in as a parameter to make the main form the parent for the
dialog.

After adding some nodes to each of the tree views, fire up the app. If you
resize the main form, you won't see flickering in the tree view. Click the
button to show the parent form and resize it - you will see horrible
flickering.

Now, why is that? With the exception of the extra panel to hold the button
on the main form, they are identical, yet the child displayed with
ShowDialog shows terrible flickering.

If I had to guess (which I guess I am guessing right now :-) I'd say
Microsoft was expecting that forms shown with "ShowDialog" would not be made
resizable so they left out paint optimizations when resizing. If that is
the case, how do we get rid of the flickering when resizing a dialog?

Thanks,
Terry
 
I have a little more information about this.

I discovered that the tree flickering only happens on XP when the XP themes
are enabled. If the "Windows classic" style is used, the tree view does not
flicker when the dialog is resized.
 

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

Back
Top