My grid has 1440 columns and when I scroll across (using the mouse), I regularly don't get any scroll events (I'm catching the WindowScrolled, WindowScrolling and ScrollInfoChanged events). It usually fires if I do a really fast drag click, but never when I hold the scroll bar down for a second or so. Can anyone help me please?
when you hold the scrollbar arrow button down for a while the grid will accelerate the scrolling. At first it will increase the frequency of scroll messages sent and as a next step increase the number of columns scrolled at one time.
At that time the scroll event will not be raised once for each column any more but instead it will be raised once for every three columns.
You can check the LeftColIndex value to find out about the new left column index.
I'll also make a note to add an option that will let you customize the accelaration so that you are able to turn it off comepletely or just avoid increasing the number of columns scrolled at one time.
BTW - there is also a LeftColChanging and LeftColChanged event that might be better for you. The other scroll methods will be called whenever the ScrollWindow API is called, e.g. also when you just resize a column.
SHSue HarrisDecember 4, 2002 08:13 PM UTC
Thanks, I tried your suggestion using the LeftColChanged and TopColChanged events and it has really helped.
However, I do notice that if I turn on the ThumbTrack the events get called fairly spasmodically when dragging the scroll. So while dragging the scroll back and forth the grid is scrolling smoothly but the event only gets called about every second. Do you have any suggestions there?
Thanks very much for your help so far.
AdministratorDecember 4, 2002 09:29 PM UTC
LeftColChanging and LeftColChanged will be called whenever the grid has been scrolled to a new position. But, the scroll thumb will only fire a new scroll event when the grid has been completetly painted. It will always be a bit jumpy if you have lots of cells. You might check if you do any custom calculations in QueryCellInfor or PrepareViewStyleInfo or when custom drawing a cell that could slow down the painting process. Once a second sounds too less frequent. If you want us to look at an example and see what could be wrong with its implementation just open a direct-trac incident and post it there.