如何更改ScrollBar的宽度? [英] How do I change the width of a ScrollBar?

查看:645
本文介绍了如何更改ScrollBar的宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改TFrame的ScrollingBar宽度。

我知道我可以通过以下方式更改系统中的所有ScrollingBars:

  SystemParametersInfo(SPI_SETNONCLIENTMETRICS,... 

但是我该怎么做对于特定的WinControl?

解决方案

Delphi中的很多代码取决于滚动条的宽度是固定的系统设置您不能在不破坏控件的情况下更改宽度(不需要在VCL中重写TControlScrollBar和相关控件)。



当然,您可以隐藏默认值控件的滚动条,并在其旁边添加您自己的TScrollbar组件。


标准TScrollBar类是一个WinControl本身,滚动条采用控件的整个宽度和高度,TControlScrollBar类与其他WinControl链接管理分配给Windowed控件的默认滚动条,而原始API可以创建您可能会使用更灵活的宽度,您总是会遇到这样的问题:VCL将会采用这些控件的默认系统定义宽度。



这也显示两个滚动条类型之间最大的区别是:TScrollBar具有自己的Windows句柄,而TControlScrollBar从相关控件中借用它。


I would like to change a TFrame's ScrollingBar width.
I know I could change all ScrollingBars in the system by:

SystemParametersInfo(SPI_SETNONCLIENTMETRICS,....

But how do I do it for a specific WinControl?

解决方案

A lot of the code within Delphi depends on the width of scrollbars to be the fixed system setting so you can't alter the width without breaking the control. (Not without rewriting the TControlScrollBar and related controls in the VCL.)

You could, of course, hide the default scrollbars of the control and add your own TScrollbar components next to it.


The standard TScrollBar class is a WinControl itself, where the scrollbar is taking the whole width and height of the control. The TControlScrollBar class is linked to other WinControl to manage the default scrollbars that are assigned to Windowed controls. While the raw API could make it possible to use a more flexible width, you'd always have the problem that the VCL will just assume the default system-defined width for these controls.

This also shows the biggest difference between both scrollbar types: TScrollBar has it's own Windows handle while TControlScrollBar borrows it from the related control.

这篇关于如何更改ScrollBar的宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆