This project is read-only.

Help with Scrollbar

Mar 23, 2011 at 1:03 AM

Hello all,

Hope someone would please point me the right direction. I am trying to use the scroll bars in the Grid to control another Grid on another form. So I have two forms with Grid but want to control the scrolling on the form below with the scrollbars on the forms on top. Any help is really appreciated.


Mar 24, 2011 at 1:40 AM

You probably could use the scroll event on one grid to execute the custom scroll method on the other grid.  If you want both grids to control scrolling the other grid, you will have to write some logic to prevent looping since executing the custom scroll will result in raising a scroll event.

I don't have sample code at the moment.  Good Luck.

Mar 24, 2011 at 3:27 PM

Thanks Joemohr.

Now I have a background image on a grid and I want to scroll the image as the grid but I'm having a hard time capturing the scroll event of a grid. Please how should I go about it. I am wondering if I should just create a new class that extends the customscrollcontrol.cs class and then override the methods. If I do so how do I make that implementation take effect. Otherwise can I just capture scroll events and add it to the form on which the grid is on? This is my first project in C# so I quiet confused with stuff.

Please any help is much appreciate from anyone.

Thank you

Apr 12, 2011 at 2:48 PM

skelo, my apologies.  I have been very busy and didn't see your reply.  I capture the event via:

grid.VScrollPositionChanged += new ScrollPositionChangedEventHandler(grid_Scroll);


Apr 13, 2011 at 3:33 PM

Hello Joemohr,

Thank you very much. I found this way after trying the ideas I posted earlier.  I was surpriced it worked and even found a way to make the application better. Sourcegrid is really awesome and you are awesome too :)


Thank you and kind regards