We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

currentcell.moveto and scrollinview

Thread ID:

Created:

Updated:

Platform:

Replies:

25337 Feb 24,2005 12:03 PM Mar 14,2005 12:08 PM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 24, 2005 12:03 PM

We use the .moveto and scrollinview in our app all over the place. We finally used it on a form the other day where we wished the moveto and scrollinview would not only bring it in view but also make the currentcell''s row be the first row in the grid, or at least as high as it could go depending on where you were in your grid. say your current cell was on row 50 out of 100 and when you do the scroll it puts row 50 at the bottom of the grids displayed area. is there anyway you can make row 50 scroll in view at the top of that area when you can?

Administrator [Syncfusion]
Replied On February 24, 2005 12:34 PM

If you want the top row to be some particular rowindex, then set grid.TopRowIndex = someParticularRowIndex; This will force the display to be scrolled so the specified row is at the top.

Philip Bishop
Replied On March 14, 2005 11:06 AM

Clay, This works great but i was trying to add one functionality to it. If i scroll the bottom row to the top then i show the huge gap at the bottom of the grid that is empty. Is there a way i can say only scroll to the top as long as its not going to result in a huge dead space at the bottom? I thougth if i always show 10 rows on a screen then calculate it from the one i wan to bring to the top and if its a certain number dont bring it to the top. The only problem with that is if someone changes the screen resolution higher then what we develop in and test at that it can show more rows on screen at a time.

Administrator [Syncfusion]
Replied On March 14, 2005 12:08 PM

This will take a little coding on your part. You can use grid.RowHeights.GetTotal to compute the sum of the row heights from a ''potential'' TopRowIndex the grid.RowCount row. If this exceeds grid.ClientSize.Height minus the height of any frozen rows, then you can actually set this ''potential'' toprowindex to be teh TopRowIndex. If it does not exceed the client height, then instead of setting this potential index as the toprowindex, use ScrollCellInView to move that row into view (but not up to the top.) Or, you could calculate the exact TopRowIndex to set so most of the client area is occupied by the grid. To calculate the exact TopRowIndex, you can repeatedly call grid.RowHeights.GetTotal with a variable first row and always using grid.RowCOunt as the last row. Continue decrementingthe first row in teh loop until GetTotal exceeds the client height.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;