コード例 #1
0
        //============================================================================*
        // cFirearmListView() - Constructor
        //============================================================================*

        public cFirearmListView(cDataFiles DataFiles)
            : base(DataFiles, cPreferences.eApplicationListView.FirearmsListView)
        {
            m_DataFiles = DataFiles;

            //----------------------------------------------------------------------------*
            // Set Properties
            //----------------------------------------------------------------------------*

            SetColumns();

            CheckBoxes = true;

            Font = new System.Drawing.Font(Font, System.Drawing.FontStyle.Bold);

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            //----------------------------------------------------------------------------*
            // Populate Columns and Groups
            //----------------------------------------------------------------------------*

            PopulateGroups();

            SortingOrder = m_DataFiles.Preferences.FirearmSortOrder;

            SortingColumn = m_DataFiles.Preferences.FirearmSortColumn;

            ListViewItemSorter = new cListViewFirearmComparer(SortingColumn, SortingOrder);

            Populate();

            Initialized = true;
        }
コード例 #2
0
        //============================================================================*
        // OnColumnClick()
        //============================================================================*

        protected override void OnColumnClick(ColumnClickEventArgs args)
        {
            if (args.Column == SortingColumn)
            {
                SortingOrder = (SortingOrder == SortOrder.Ascending) ? SortOrder.Descending : SortOrder.Ascending;

                m_DataFiles.Preferences.FirearmSortOrder = SortingOrder;

                ListViewItemSorter = new cListViewFirearmComparer(SortingColumn, SortingOrder);
            }
            else
            {
                SortingColumn = args.Column;

                this.Invalidate(true);

                ListViewItemSorter = new cListViewFirearmComparer(SortingColumn, SortingOrder);
            }

            if (SelectedItems.Count > 0)
            {
                SelectedItems[0].EnsureVisible();
            }

            m_DataFiles.Preferences.FirearmSortColumn = args.Column;
        }