----- Original Message ----- From: neomavez > procedure TBuildFCtree.TreeWndProc(var Message: TMessage); > begin > OldWndProc(Message); > if Message.Msg = WM_VSCROLL then > begin > Self.Invalidate; > end; > end;
> This code works fine, Each time you click on the scroll bar, the > TreeView repaint itself. > But if I move down with keys up or down (Assuming that the number of > items beyond the bottom of the component) WM_VSCROLL is not received > => The component not repaint Itself. Should I catch another message? for a quicky solution instead of WM_VSCROLL, I would go with WM_ERASEBKGND, procedure TMyTree.TreeWndProc(var Message: TMessage); var r :TRect; begin if( Message.Msg = WM_ERASEBKGND )then begin r := bt.ClientRect; r.Right := r.Right +1; r.Bottom := r.Bottom +1; InvalidateRect( Handle,@r,FALSE ); end; OldWndProc(Message); end; I'm guessing that +1 is GetSystemMetrics( SM_CXBORDER )