Пример #1
0
        protected override void OnColumnClick(ColumnClickEventArgs e)
        {
            base.OnColumnClick(e);
            var       new_sorting_column = Columns[e.Column];
            SortOrder sort_order;

            if (SortingColumn == null)
            {
                sort_order = SortOrder.Ascending;
            }
            else
            {
                if (new_sorting_column == SortingColumn)
                {
                    if (SortingColumn.Text.StartsWith("> "))
                    {
                        sort_order = SortOrder.Descending;
                    }
                    else
                    {
                        sort_order = SortOrder.Ascending;
                    }
                }
                else
                {
                    sort_order = SortOrder.Ascending;
                }
                SortingColumn.Text = SortingColumn.Text.Substring(2);
            }
            SortingColumn = new_sorting_column;
            if (sort_order == SortOrder.Ascending)
            {
                SortingColumn.Text = "> " + SortingColumn.Text;
            }
            else
            {
                SortingColumn.Text = "< " + SortingColumn.Text;
            }
            ListViewItemSorter =
                new ListViewComparer(e.Column, sort_order);
            Sort();
        }
Пример #2
0
        private void btn_sortSites_Click(object sender, EventArgs e)
        {
            ColumnClickEventArgs eArgs = new ColumnClickEventArgs(1);

            ListViewComparer.ColumnHeaderClickEvent(sender, eArgs, lw_Sites);
        }
Пример #3
0
 private void listView_ColumnClick(object sender, ColumnClickEventArgs e)
 {
     ListViewComparer.ColumnHeaderClickEvent(sender, e, (ListView)sender);
 }
Пример #4
0
 protected override void OnLoad(EventArgs e)
 {
     listViewcomparer = new ListViewComparer(listViewThreads);
     listViewThreads.ListViewItemSorter = listViewcomparer;
     listViewThreads.Sorting = SortOrder.Ascending;
 }