/// <summary>
/// 显示列顺序
/// </summary>
/// <param name="list"></param>
private void ShowColumnIndex(List<SelectColumn> list)
{
foreach (var i in list)
{
SelectColumn selectColumn = i;
foreach (var column in rgv_Control.Columns.Where(column => !column.Name.Equals("Num") && !column.Name.Equals("ChkSelect")).Where(column => selectColumn.ColumnName.Equals(column.Name)))
{
var oldIndex = column.Index;
var newIndex = i.ShowIndex;
if (oldIndex > newIndex)
{
rgv_Control.Columns.Move(oldIndex, newIndex);
rgv_Control.Columns.Move(newIndex + 1, oldIndex);
}
else if (oldIndex < newIndex)
{
rgv_Control.Columns.Move(oldIndex, newIndex);
rgv_Control.Columns.Move(newIndex - 1, oldIndex);
}
break;
}
}
}