简体   繁体   English

有没有办法确定滚动条在 TDBGrid 上是否可见

[英]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.我想在TDBGrid的右下角显示一些东西,但我不想覆盖滚动条。

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 ).可能最好的方法是使用ClientRect属性,它以自己的坐标给出控件的客户矩形(这意味着LeftTop始终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.为了比较, BoundsRect属性是父窗口坐标系中 window 的完整矩形。

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结果是

用右下角的雪人控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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