It is easy to detect whether the vertical scrollbar of a TScrollBox
is at the very top or not:
IsScrollBarAtTop := ScrollBox1.VertScrollBar.Position = 0;
But how can I detect whether the vertical scrollbar of a TScrollBox
is at the very BOTTOM or not?
You can retrieve scroll bar information through the API and determine if its at the bottom.
function IsScrollBarAtBottom(Box: TScrollBox): Boolean;
var
Info: TScrollInfo;
begin
Info.cbSize := SizeOf(Info);
Info.fMask := SIF_POS or SIF_RANGE or SIF_PAGE;
Win32Check(GetScrollInfo(Box.Handle, SB_VERT, Info));
Result := Info.nPos >= Info.nMax - Info.nMin - Info.nPage;
end;