} // SetSetting // ---------------------------------------------------------------------- public override void Load() { try { GridView gridView = listView.View as GridView; if (gridView == null || gridView.Columns.Count == 0) { return; } GridViewColumnSetting[] columnSettings = OriginalColumnSettings; if (columnSettings == null || columnSettings.Length == 0) { return; } for (int displayIndex = 0; displayIndex < columnSettings.Length; displayIndex++) { GridViewColumnSetting columnSetting = columnSettings[displayIndex]; if (columnSetting.Index < 0 || columnSetting.Index >= gridViewColumns.Count) { continue; } GridViewColumn gridViewColumn = gridViewColumns[columnSetting.Index]; if (useWidth) { gridViewColumn.Width = columnSetting.Width; } if (!useDisplayIndex) { continue; } if (columnSetting.Index == columnSetting.DisplayIndex) { continue; } int oldIndex = gridView.Columns.IndexOf(gridViewColumn); gridView.Columns.Move(oldIndex, columnSetting.DisplayIndex); } } catch { if (ThrowOnErrorLoading) { throw; } } } // Load
} // Width // ---------------------------------------------------------------------- public override bool Equals(object obj) { if (obj == this) { return(true); } GridViewColumnSetting compare = obj as GridViewColumnSetting; if (compare == null) { return(false); } return (int.Equals(index, compare.index) && int.Equals(displayIndex, compare.displayIndex) && double.Equals(width, compare.width)); } // Equals