difference between SuspendLayout/ResumeLayout andBeginUpdate/EndUpdate

  • Thread starter Thread starter timor.super
  • Start date Start date
T

timor.super

Hi all,

I've read that if i have to add many item to my listview/treeview/...
I can use SuspendLayout or BeginUpdate and after resume with
ResumeLayout or EndUpdate

But I don't understand when to use one instead the other.
Should I use the both ?

Thanks for your help
 
SuspendLayout / ResumeLayout are used when arranging controls within a form
(typically when the form is being created) in order to prevent flicker (if
the form is visible) or countless unnecessary re-calculations of control
alignment (when form is being created).

BeingUpdate/EndUpdate are used when you are going to be modifying data at
runtime (adding / removing nodes, adding lines to a ListBox, etc) and don't
want the control to have to repaint or resize its scrollbars until you have
finished.

Typically you will never call the layout methods.


Pete
 
If you are editing, use BeginUpdate/EndUpdate. Layout prevents a few
anchoring etc glitches when moving controls about / resizing
containers. Of course, you could edge on the side of caution and do
both, but it is BeginUpdate/EndUpdate that you want.

Marc
 
SuspendLayout / ResumeLayout are used when arranging controls within a form
(typically when the form is being created) in order to prevent flicker (if
the form is visible) or countless unnecessary re-calculations of control
alignment (when form is being created).

BeingUpdate/EndUpdate are used when you are going to be modifying data at
runtime (adding / removing nodes, adding lines to a ListBox, etc) and don't
want the control to have to repaint or resize its scrollbars until you have
finished.

Typically you will never call the layout methods.

Pete

Ok,

I understand better.
Thanks all for your answer

Best regards
 
Back
Top