tags:

views:

303

answers:

2

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?

+1  A: 

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.

Workshop Alex
A: 

You can try something like this:

  your_frame.HorzScrollBar.Size := 50;
  your_frame.HorzScrollBar.ButtonSize := your_frame.HorzScrollBar.Size;
Nick D
This *might* work if you use flat scrollbars and have a Comctl32.dll below version 6. See also http://msdn.microsoft.com/en-us/library/bb775438(VS.85).aspx and http://msdn.microsoft.com/en-us/library/bb787529(VS.85).aspx
Workshop Alex