会发 gif 了,发一下实际效果图
添加如下代码:
    wnGridMain.MouseWheel += wnGridMain_MouseWheel;
    wnGridChose.MouseWheel += wnGridChose_MouseWheel;
/// <summary>
/// 响应WnGridMain的MouseWheel事件
/// </summary>
private void wnGridMain_MouseWheel(object sender, MouseEventArgs e)
{
    /* 保证第一行RowIndex相同,保持滚动一致 */
    wnGridChose.TopRowIndex = wnGridMain.TopRowIndex;
}
/// <summary>
/// 响应wnGridChose的MouseWheel事件
/// </summary>
private void wnGridChose_MouseWheel(object sender, MouseEventArgs e)
{
    /* 保证第一行RowIndex相同,保持滚动一致 */
    wnGridMain.TopRowIndex = wnGridChose.TopRowIndex;
}
3.如若进行排序操作,添加如下代码:
    wnGridMain.GridView.EndSorting += wnGridMain_GridView_EndSorting;
    wnGridChose.GridView.EndSorting += wnGridChose_GridView_EndSorting;
/// <summary>
/// 响应wnGridMain_GridView的EndSorting事件
/// </summary>
private void wnGridMain_GridView_EndSorting(object sender, EventArgs e)
{
    /* 创建ht接收来自wnGridMain的排序参数信息(正序or倒序) */
    Hashtable ht = new Hashtable();
    foreach (GridColumnSortInfo i in wnGridMain.GridView.SortInfo)
    {
        ht[i.Column.FieldName] = i.SortOrder;
    }
    /* List参数接收变量接收来自GridColumnSortInfo的详细信息(哪一列按照什么排序规则进行排序) */
    List<GridColumnSortInfo> list = new List<GridColumnSortInfo>();
    foreach (string keys in ht.Keys)
    {
        GridColumnSortInfo s = new GridColumnSortInfo(wnGridChose.GridView.Columns[keys], (ColumnSortOrder)ht[keys]);
        list.Add(s);
    }
    /* 同步更新至另一个Grid的排序信息,先clear再加,保证均为List内的排序规则 */
    wnGridChose.GridView.SortInfo.ClearAndAddRange(list.ToArray());
}
/// <summary>
/// 响应wnGridChose_GridView的EndSorting事件
/// </summary>
private void wnGridChose_GridView_EndSorting(object sender, EventArgs e)
{
    /* 创建ht接收来自wnGridMain的排序参数信息(正序or倒序) */
    Hashtable ht = new Hashtable();
    foreach (GridColumnSortInfo i in wnGridChose.GridView.SortInfo)
    {
        ht[i.Column.FieldName] = i.SortOrder;
    }
    /* List参数接收变量接收来自GridColumnSortInfo的详细信息(哪一列按照什么排序规则进行排序) */
    List<GridColumnSortInfo> list = new List<GridColumnSortInfo>();
    foreach (string keys in ht.Keys)
    {
        GridColumnSortInfo s = new GridColumnSortInfo(wnGridMain.GridView.Columns[keys], (ColumnSortOrder)ht[keys]);
        list.Add(s);
    }
    /* 同步更新至另一个Grid的排序信息,先clear再加,保证均为List内的排序规则 */
    wnGridMain.GridView.SortInfo.ClearAndAddRange(list.ToArray());
}
注:此方法存在弊端,只能设置一个 Grid 进行编辑,另外一个不允许编辑,否则会出现各种不可预知性异常。 不会添加 gif 图片。。。想看实际效果的可以告知模块名称看实际模块效果。也可以提供源码~~