I want to display something in the bottom right of a TDBGrid
, but I don't want to overwrite the scrollbars.
Is there a nice way of determining if the scrollbars are visible? (and their size)
Join Stack Overflow to learn, share knowledge, and build your career.
I want to display something in the bottom right of a TDBGrid
, but I don't want to overwrite the scrollbars.
Is there a nice way of determining if the scrollbars are visible? (and their size)
Probably the best approach is to use the ClientRect
property, which gives the client rectangle of the control in its own coordinates (which implies that Left
and Top
are always 0
). The "client rectangle" is the part of the control which is not border and scroll bar.
For comparison, the BoundsRect
property is the full rectangle of the window in the parent window's coordinate system.
For example,
and
pnSnowman.SetBounds(
DBGrid1.Left + DBGrid1.ClientWidth - pnSnowman.Width - 8,
DBGrid1.Top + DBGrid1.ClientHeight - pnSnowman.Height - 8,
pnSnowman.Width,
pnSnowman.Height
);
results in
ClientRect
property which is the rect not occupied by scroll bars. Compare with theBoundsRect
property. – Andreas Rejbrand Feb 22 at 21:39