有没有办法改变delphi 2010中的滚动条样式?
我刚刚在构建 delphi 2010 应用程序时注意到滚动条在显示时始终具有相同的大小。无论实际需要滚动多少内容,条中间的滚动条始终具有相同的大小。相比之下,大多数现代应用程序使用滚动条,其中滚动条的大小与可滚动的量成正比,因此通过查看就可以清楚有多少内容可供滚动。有没有办法改变我的delphi控件上的滚动属性,或者需要自定义控件?
编辑: 此特定实例中的组件是 TDBGrid,它水平滚动。我没有意识到Windows正在绘制这些滚动条。也许沃伦是对的,但这个问题是无法回答的。比例滚动条在 Windows 上可能并不普遍,但我还没有在我的 Windows 机器上找到不使用它们的程序。甚至 Delphi 2010 IDE 也使用它们。
I just noticed while building a delphi 2010 application that the scrollbar is always the same size when it shows up. The scroller in the middle of the bar is always the same size no matter how much there actually is to scroll. In contrast, most modern applications use scrollbars where the size of the scroller is proportional to the amount available to scroll, so that by looking it is clear how much there is to scroll through. Is there a way to change the scroll properties on my delphi controls, or would that require custom controls?
edit:
The component in this particular instance was a TDBGrid, which scrolled horizontally. I didn't realize that windows was drawing these scrollbars. Perhaps Warren is correct and the question is unanswerable. Proportional scrollbars may not be ubiquitous on windows but I have yet to find a program on my windows machine that doesn't use them. Even the delphi 2010 IDE uses them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我在我的自定义组件(一个简单的文本查看器)中执行此操作的方法:
IOW,您使用
TScrollInfo
,用您需要更改的值填充它,包括nMax< /code> 和
nPage
,并用它调用SetScrollInfo
,指示要更改的滚动条。我确信大多数带有滚动条的控件都会在内部控制它们,但如果控件没有,您可以尝试SetScrollInfo
。这可能对其中一些人有用。TScrollInfo
和SetScrollInfo
在Windows.pas
中定义。这是MSDN 链接。This is how I do it in a custom component of mine (a simple text viewer):
IOW, you use a
TScrollInfo
, fill it up with the values you need to change, includingnMax
andnPage
, and callSetScrollInfo
with it, indicating the scroll bar you want to change. I'm sure that most controls with scroll bars control them internally, but if a control doesn't, you could trySetScrollInfo
. It might work for some of them.TScrollInfo
andSetScrollInfo
are defined inWindows.pas
. Here is the MSDN link.