示例#1
0
        private void cmbCatalog_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbCatalog.SelectedItem is CatalogComboItem)
            {
                CatalogComboItem        item   = (CatalogComboItem)cmbCatalog.SelectedItem;
                List <CatalogComboItem> delete = new List <CatalogComboItem>();
                foreach (CatalogComboItem i in cmbCatalog.Items)
                {
                    if (i is DriveComboItem)
                    {
                        continue;
                    }
                    if (i.Level > item.Level)
                    {
                        delete.Add(i);
                    }
                }
                foreach (CatalogComboItem i in delete)
                {
                    cmbCatalog.Items.Remove(i);
                }

                if (SelectedItemChanged != null)
                {
                    SelectedItemChanged((CatalogComboItem)cmbCatalog.SelectedItem);
                }
            }
            else
            {
                if (SelectedItemChanged != null)
                {
                    SelectedItemChanged(null);
                }
            }
        }
示例#2
0
        private void cmbCatalog_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0 || e.Index >= cmbCatalog.Items.Count)
            {
                return;
            }
            if (!(cmbCatalog.Items[e.Index] is CatalogComboItem))
            {
                return;
            }

            //DrawItemState.
            CatalogComboItem item = (CatalogComboItem)cmbCatalog.Items[e.Index];
            int level             = item.Level;

            if ((e.State & DrawItemState.ComboBoxEdit) == DrawItemState.ComboBoxEdit)
            {
                level = 0;
            }

            using (SolidBrush brush = new SolidBrush(Color.Black))
            {
                Rectangle rect = new Rectangle(e.Bounds.X + level * 11 + 18, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
                if ((e.State & DrawItemState.Selected) == DrawItemState.Selected &&
                    (e.State & DrawItemState.ComboBoxEdit) != DrawItemState.ComboBoxEdit)
                {
                    brush.Color = Color.DarkBlue;
                    e.Graphics.FillRectangle(brush, rect);
                    brush.Color = Color.White;
                }
                else
                {
                    brush.Color = Color.White;
                    e.Graphics.FillRectangle(brush, rect);
                    brush.Color = Color.Black;
                }
                try
                {
                    Image image = ExplorerImageList.List[item.ImageIndex];
                    e.Graphics.DrawImage(image, e.Bounds.X + level * 11 + 3, e.Bounds.Y);
                }
                catch { }
                e.Graphics.DrawString(item.ToString(), cmbCatalog.Font, brush, e.Bounds.X + level * 11 + 20, e.Bounds.Y + 2);
            }
        }
        private void catalogComboBox1_SelectedItemChanged(CatalogComboItem item)
        {
            if (contentsList1.ShowWith(item.ExplorerObject))
            {
                contentsList1.ExplorerObject = item.ExplorerObject;
            }
            else
            {
                contentsList1.ExplorerObject = null;
            }

            SetElementTextBoxVisibility();

            if (ItemSelected != null)
            {
                _selectedObjects.Clear();
                ItemSelected(_selectedObjects);
            }
        }
示例#4
0
        async private void catalogComboBox1_SelectedItemChanged(CatalogComboItem item)
        {
            if (await contentsList1.ShowWith(item.ExplorerObject))
            {
                await contentsList1.SetExplorerObjectAsync(item.ExplorerObject);
            }
            else
            {
                await contentsList1.SetExplorerObjectAsync(null);
            }

            await SetElementTextBoxVisibility();

            if (ItemSelected != null)
            {
                _selectedObjects.Clear();
                ItemSelected(_selectedObjects);
            }
        }
示例#5
0
        public void MoveUp()
        {
            if (cmbCatalog.SelectedIndex < 1)
            {
                return;
            }
            if (cmbCatalog.SelectedItem is DriveComboItem)
            {
                return;
            }

            if (cmbCatalog.SelectedItem is CatalogComboItem)
            {
                CatalogComboItem item = (CatalogComboItem)cmbCatalog.SelectedItem;
                if (item.Level > 0)
                {
                    cmbCatalog.SelectedIndex--;
                }
            }
        }