该文章介绍怎样通过 JS 代码操作 Spread 滚动条:
1.操作步骤:点击 button 通过像素值设置滚动条位置。选择 Select Option 通过 Spread 前台方法 SetActiveCell 控制滚动条位置。
2.截图:

3.参考代码:

 
function Button1_onclick() {

            var spread = document.getElementById("FpSpread1_view");

            var scrollTopPosition = spread.scrollTop;

            var scrollLeftPosition = spread.scrollLeft;

            spread.scrollLeft = 200;

            spread.scrollTop = 200;

        }

        function change() {

            var spread = document.getElementById("FpSpread1");

            var select = document.getElementById("Select1");

            var row = select.options[select.selectedIndex].value;

            spread.SetActiveCell(row, 0);

        }

        function window.onload() {

            var spread = document.getElementById("FpSpread1"); ;

            spread.SetActiveCell(32, 0);

            var cell = spread.GetCellByRowCol(32, 0);

            var rowHeader = spread.all(spread.id + "_rowHeader");

            var colHeader = spread.all(spread.id + "_colHeader");

            var view = spread.all(spread.id + "_view");



            if (view != null) {

                view.scrollTop = cell.offsetTop;

                view.scrollLeft = cell.offsetLeft;

            }

        } 

复制代码

环境:VS 2010 && Spread for .NET 6 SP3

HandleScrollBar.zip (2.87 M, 下载次数:18)