//============================================================================* // cManufacturerListView() - Constructor //============================================================================* public cManufacturerListView(cDataFiles DataFiles) : base(DataFiles, cPreferences.eApplicationListView.ManufacturersListView) { m_DataFiles = DataFiles; //----------------------------------------------------------------------------* // Set Properties //----------------------------------------------------------------------------* GridLines = true; Font = new System.Drawing.Font(Font, System.Drawing.FontStyle.Bold); //----------------------------------------------------------------------------* // Event Handlers //----------------------------------------------------------------------------* //----------------------------------------------------------------------------* // Populate Columns and Data //----------------------------------------------------------------------------* PopulateColumns(m_arColumns); SortingOrder = m_DataFiles.Preferences.ManufacturerSortOrder; SortingColumn = m_DataFiles.Preferences.ManufacturerSortColumn; ListViewItemSorter = new cListViewManufacturerComparer(SortingColumn, SortingOrder); Populate(); Initialized = true; }
//============================================================================* // OnColumnClick() //============================================================================* protected override void OnColumnClick(ColumnClickEventArgs args) { if (args.Column == SortingColumn) { SortingOrder = (SortingOrder == SortOrder.Ascending) ? SortOrder.Descending : SortOrder.Ascending; m_DataFiles.Preferences.ManufacturerSortOrder = SortingOrder; ListViewItemSorter = new cListViewManufacturerComparer(SortingColumn, SortingOrder); } else { SortingColumn = args.Column; this.Invalidate(true); ListViewItemSorter = new cListViewManufacturerComparer(SortingColumn, SortingOrder); } if (SelectedItems.Count > 0) { SelectedItems[0].EnsureVisible(); } m_DataFiles.Preferences.ManufacturerSortColumn = args.Column; }