[]
        
(Showing Draft Content)

C1.Win.FlexGrid.Util.BaseControls.ScrollableControl.ScrollPosition

ScrollPosition Property

ScrollPosition

Gets or sets the location of the auto-scroll position.

Declaration
[Browsable(false)]
public Point ScrollPosition { get; set; }
Remarks

Use the ScrollPosition property to get or set the scroll position using pixel coordinates.

Use the TopRow and LeftCol properties to get or set the scroll position using cell coordinates.

Examples

This code binds two grids (_flexLeft and _flexRight) together and synchronizes their scrolling in the vertical direction (the user can scroll the grids independently in the horizontal direction).

// bind grids together
_flexRight.DataSource = _flexLeft;
_flexLeft.ScrollBars = ScrollBars.Horizontal;

// synchronize vertical scrolling 
// (this handles the AfterScroll event for both grids)
void flex_AfterScroll(object sender, C1.Win.FlexGrid.RangeEventArgs e)
{
    // update sender grid (could be _flexLeft or _flexRight)
    C1FlexGrid.C1FlexGrid src = ((C1FlexGrid)sender);
    src.Update();

    // get new vertical position from sender grid
    int y = src.ScrollPosition.Y;

    // apply new vertical position to the other grid
    if (src.Equals == _flexLeft)
    {
        _flexRight.ScrollPosition = new Point(_flexRight.ScrollPosition.X, y);
    }
    else
    {
        _flexLeft.ScrollPosition = new Point(_flexLeft.ScrollPosition.X, y);
    }
}