Consider the following very simple unit:
Unit1.pas
unit Unit1; interface uses Windows, Classes, Controls, Forms, ComCtrls; type T
Very simple, use TreeView1.Items.BeginUpdate/EndUpdate methods and the scrollbar will be calculated accordingly.
TreeView1.Items.BeginUpdate/EndUpdate
like this:
... TreeView1.Items.BeginUpdate; // change your nodes here TreeView1.Items.EndUpdate