Double Buffer panel within SplitContainer to avoid TreeView flicke

G

Guest

I have a treeview derived control placed within Panel2 of a SplitContainer
control on a form. The TreeView flickers during updates so I set the
DoubleBuffered attribute to true (in the constructor of my class derived from
TreeView).

It still flickers so I was thinking that it could be that DoubleBuffered
also needs to be set within the parent panel that contains this TreeView
derived control. However, in this case, the parent is a panel that belongs
to a SplitContainer. Of course, I can't directly set the DoubleBuffered
property of Panel2 and I was wondering if there is some other way to do this
or if I'm on the wrong track altogether.

Also, I'm using C++/CLI and the tree view nodes are user-drawn, does this
for any reason automatically rule out the use of double buffering on the
related tree view?

Thanks
David
 
L

Linda Liu [MSFT]

Hi David,

Thank you for posting.

This is a quick note to let you know that I am performing research on this
issue and I will get back to you as soon as possible. I appreciate your
patience.

Sincerely,
Linda Liu
Microsoft Online Community Support

============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.

============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Todd Wilder

I created my own SplitContainer type control and had similar issues (One of the panels would not stop flickering), even with C# setstyle (UserPaint, AllPaintinginWMPaint, OptimizedDoubleBuffer), etc. Then I discovered that if I used .SendToBack() (or maybe it was .BrintToFront()) on my flickering panel, it wouldnt flicker. Hope this helps.
 
L

Linda Liu [MSFT]

Hi David,

The DoubleBuffered is a property of Control, which gets or sets a value
indicating whether this control should redraw its surface using a secondary
buffer to reduce or prevent flicker.

Unfortunately, this property has no effect on the TreeView control.

In the sentence "The TreeView flickers during updates", do you mean the
TreeView flickers when you add tree nodes to it? If so, you should use the
BeginUpdate and EndUpdate methods of the TreeView to reduce flicker. The
BeginUdpate method prevents the control from painting until the EndUpdate
method is called.

you could call the BeginUpdate method before you add tree nodes to the
TreeView and call the EndUpdate method after you finish adding these tree
nodes.

Hope this helps.
If you have any concerns, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support
 
J

Jeff Gaines

The DoubleBuffered is a property of Control, which gets or sets a value
indicating whether this control should redraw its surface using a secondary
buffer to reduce or prevent flicker.

Unfortunately, this property has no effect on the TreeView control.

Aaaaaaaaaaagh!

That's a little nugget, could have saved me hours if I'd known :)

Are there any other controls where DoubleBuffered doesn't work? If so can
we expect (hope?) it may in the future?
 
L

Linda Liu [MSFT]

Hi Jeff,

Open MSDN Library for Visual Studio 2005, type "DoubleBuffered property" in
the input box in the Search panel on the right hand and press the Search
button. You will see all controls that don't support DoubleBuffered
property are listed in the result panel under the search input box.

These controls are listed below.
TreeView, MonthCalendar, ProgressBar, DateTimePicker, TrackBar and
StatusBar.

In addition, DoubleBuffered property isn't relevant to TextBoxBase class.
This property isn't meaningful to ToolBar and TabControl.

Maybe the above controls will support DoubleBuffered property in the future
release of VS.

Hope this helps.


Sincerely,
Linda Liu
Microsoft Online Community Support
 
G

Guest

Thanks Linda,

It turns out that most of our original problem stemmed from one place in our
code where we forgot to call Begin/End update (we update the tree view
control from multiple places). There is still a little flicker in certain
cases, but we can live with it. Thanks for the help.

Best regards,
David
 
L

Linda Liu [MSFT]

Hi David,

Thank you for your update. I am glad to hear that the problem has been
almost fixed.

If you have any other questions in the future, please don't hesitate to
contact us. It's always our pleasure to be of assistance.

Have a wonderful day!

Sincerely,
Linda Liu
Microsoft Online Community Support
 

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