简体   繁体   中英

Is there a way to determine if scrollbars are visible on a TDBGrid

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,

带有滚动条的控件及其 BoundsRect 和 ClientRect 值的屏幕截图。

and

pnSnowman.SetBounds(
  DBGrid1.Left + DBGrid1.ClientWidth - pnSnowman.Width - 8,
  DBGrid1.Top + DBGrid1.ClientHeight - pnSnowman.Height - 8,
  pnSnowman.Width,
  pnSnowman.Height
);

results in

用右下角的雪人控制。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM