1

Scrolling a TStringGrid using its horizontal scroll bar will scroll a column at a time. In some situations, this creates a really nasty behavior that makes the grid unusable: if the width of last column is large (example, 1000 pixels) the user won't be able to scroll the grid to see the entire content of the column.

There is a way to scroll by pixel? Or to set the correct scroll range for grid's scroll bar?

Gabriel
  • 20,797
  • 27
  • 159
  • 293
  • If you don't dislike painting the cell interiors yourself, then maybe [this component](http://stackoverflow.com/a/14022704/757830) could serve (as starting point)? – NGLN Dec 10 '13 at 16:40

2 Answers2

0

As far as I know, no you can't horizontally scroll the string or draw grids by pixels, only by whole columns. I agree it can be a problem by the way. I tend to autosize the columns but make the max initial size of any column be slightly less than the clientwidth of the control.

MarkF
  • 1,616
  • 1
  • 17
  • 27
  • Hi MarkF. Why do you make the column a bit smaller? Do you achieve a better behavior with this? – Gabriel Oct 24 '11 at 17:20
  • In my case it makes it more obvious to the user that they can resize that column, it is not required at all since they can still resize by mousing over the right edge of the control. – MarkF Oct 25 '11 at 13:48
0

I have looked into the source code. With Borland's code it can't be done. However, Lazarus has this capability.

Gabriel
  • 20,797
  • 27
  • 159
  • 293
  • 3
    Why is this answer superior to the one given 5 days ago? – Sertac Akyuz Feb 12 '13 at 19:14
  • I actually looked into the source code to see where is the problem and if it can be fixed. I also fired up Lazarus and tested to see its support for this. I migrated some programs to Lazarus already, and support for pixel scrolling is a NICE bonus/incentive. The new pricing policy from Embarcadero is pretty annoying. – Gabriel Oct 12 '18 at 09:25