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

Re: TreeView flashing when resizing a form by Raffaele

Raffaele
Fri Jun 04 02:13:33 CDT 2004

> 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.

Try setting double buffer via SetStyle method.

Please do not crosspost.

BTW, .it hierarchy is in Italian and so you should posto into Italian
language here.

--
Raffaele Rialdi
Microsoft .NET MVP http://mvp.support.microsoft.com -
http://italy.mvps.org UGIdotNET - User Group Italiano .NET
http://www.ugidotnet.org Weblog: http://www.ugidotnet.org/2082.blog




Re: TreeView flashing when resizing a form by Terry

Terry
Mon Jun 07 14:49:05 CDT 2004

More information on this. The TreeView only flashes in XP if the desktop is
set to use the "XP Theme". If it is set to "Windows Classic", it does not
flicker when resizing the window.

I also noticed that the folder tree in Windows Explorer flickers badly when
resizing Explorer, so perhaps, if it's OK for Microsoft, I shouldn't worry
about it.

Terry

"Terry" <cheerio12345@hotmail.com> wrote in message
news:%23PP4SuRSEHA.1388@TK2MSFTNGP09.phx.gbl...
> 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
>
>