加view的TopRowChanged事件

 

       private void gdvAllScheduling_TopRowChanged(object sender, EventArgs e)
        {
            topIndex = gdvAllScheduling.TopRowIndex;
        }
        int topIndex = -1;

       public void FoucedRefreshData()
        {

          
            var _Column = this.gdvAllScheduling.FocusedColumn;
            var _RowIndex = this.gdvAllScheduling.FocusedRowHandle;
            this.RefreshData();
            this.gdvAllScheduling.TopRowChanged -= new 
           System.EventHandler(this.gdvAllScheduling_TopRowChanged);
            this.gdvAllScheduling.FocusedColumn = _Column;
            this.gdvAllScheduling.FocusedRowHandle = _RowIndex;
            gdvAllScheduling.TopRowIndex = topIndex;//设置垂直滚动条位置
            this.gdvAllScheduling.TopRowChanged += new 
           System.EventHandler(this.gdvAllScheduling_TopRowChanged);
        }

 

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐