How about handling the scrolling yourself. Then you have an opportunity to change column widths for the affect. You will need a dummy first column that grows with horizontal scroll and you’ll need to smartly collapse the non-frozen columns. You also need to CellTextPaint the partially collapsed columns so the text slides left.
The real challenge I think is capturing all the ways that might scroll, which I think are only…
MouseWheel
ScrollBars
Resized
Set ScrollPositionX
I only handled MouseWheel in my test (easiest). For ScrollBars you’ll need to add your own to drive the Listbox. For Resizing there’s no event on Listbox, you’ll have to call an update from the Windows or ContainerControls Resizing event. For setting ScrollPositionX, that’s a Property which can’t be pragmatically intercepted, so create a MyScrollPositionX and only use that.
This creates a ‘2’ column Listbox where column 0 just pads the horizontal scroll, column 1 is a frozen 200px column, and column 2 is 1000px and slides underneath. I’m sure there’s more edge cases than I’ve pointed out here.
[code]//Listbox events
Sub Open()
me.ColumnCount = 3
me.ColumnWidths = “0,200,1000”
for i As integer = 0 to 100
me.AddRow Array(" ", Str(i), “sigmund sore to fail in the light”)
next
me.ScrollBarHorizontal = true
End Sub
Function MouseWheel(X As Integer, Y As Integer, deltaX as Integer, deltaY as Integer) As Boolean
me.ScrollPosition = me.ScrollPosition + deltaY
me.ScrollPositionX = me.ScrollPositionX + deltaX
me.ColumnWidths = Str(me.ScrollPositionX) + “,200,” + Str(1000-me.ScrollPositionX)
return true
End Function
Function CellTextPaint(g As Graphics, row As Integer, column As Integer, x as Integer, y as Integer) As Boolean
if column = 2 then
g.DrawString(me.Cell(row, column), x-me.ScrollPositionX, y)
return true
end
End Function
//test updating from Window event
Sub Resizing()
lb.ColumnWidths = Str(lb.ScrollPositionX) + “,200,” + Str(1000-lb.ScrollPositionX)
End Sub[/code]