delphitscrollbox

Check is TScrollBox scrollbars are actually visible


I have a simple sizable form with TScrollBox (Align := alClient) and some controls put on TScrollBox. If user change the form size, TScrollBox show and hide the HorzScrollBar and VertScrollBar (depend on actual client form size).

How to check at run-time - does HorzScrollBar or VertScrollBar are visible right now?

TControlScrollBar.Visible is not an answer, because it hase a regulating function only.


Solution

  • Use TControlScrollBar.IsScrollBarVisible to test this.

    Call IsScrollBarVisible to determine whether the scroll bar is visible. IsScrollBarVisible returns true if the Visible property is true and the associated scrolling windowed control contains child controls that lie within Margin pixels from the edge.