C#Winform实现拉动滚动条时dataGridView项也滚动

C#Winform实现拉动滚动条时dataGridView项也滚动

这样做:

/// <summary>
/// 滚动条滚动事件
/// </summary>
private void scrollBar_Scroll(object sender, ScrollEventArgs e)
{
    if (e.NewValue>=rowNo)//若当前值不小于行号,则不执行后面代码
    {
        return;
    }
    dataGridView.FirstDisplayedScrollingRowIndex = e.NewValue;            
}

猜你喜欢

转载自blog.csdn.net/qq_33712555/article/details/80074033