예제 #1
0
        public FrmShowBidEntry(List <ArtShowItem> items)
        {
            InitializeComponent();
            Items        = items;
            Current      = null;
            CurrentIndex = -1;

            LstItems.BeginUpdate();
            foreach (var showItem in items)
            {
                var item = new ListViewItem {
                    Text = showItem.ShowNumber.ToString()
                };
                item.SubItems.Add(showItem.Title);
                item.SubItems.Add(showItem.PurchaserNumber.ToString());
                item.SubItems.Add(showItem.FinalSalePrice != null ? ((decimal)showItem.FinalSalePrice).ToString("C") : "");
                item.BackColor = showItem.Auctioned ? Color.LightGreen : Color.White;
                item.Tag       = showItem;
                LstItems.Items.Add(item);
            }
            LstItems.ListViewItemSorter = new ListViewItemComparer(0, true);
            LstItems.Sort();
            LstItems.EndUpdate();
            LstItems.Items[0].Selected = true;
        }
예제 #2
0
        private void LstItems_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            if (Math.Abs(ItemsSortColumn) == Math.Abs(e.Column))
            {
                ItemsSortAscend = !ItemsSortAscend;
                LstItems.Columns[e.Column].ImageIndex = ItemsSortAscend ? 0 : 1;
            }
            else
            {
                LstItems.Columns[ItemsSortColumn].ImageIndex = -1;
                LstItems.Columns[ItemsSortColumn].TextAlign  = LstItems.Columns[ItemsSortColumn].TextAlign;
                ItemsSortAscend = true;
                ItemsSortColumn = e.Column;
                LstItems.Columns[e.Column].ImageIndex = 0;
            }

            LstItems.BeginUpdate();
            LstItems.ListViewItemSorter = new ListViewItemComparer(e.Column, ItemsSortAscend);
            LstItems.Sort();
            LstItems.EndUpdate();
        }