private void DeleteCurrentAction() { KryptonListItem item = (KryptonListItem)this.listCurrentActions.SelectedItem; int index = this.listCurrentActions.SelectedIndex; Command cmd = (Command)item.Tag; this.listCurrentActions.Items.Remove(item); if (cmd != null) { if (this.changedImages.ContainsKey(cmd)) { this.changedImages.Remove(cmd); } item.Image = CommandImageCollection.GetImage(cmd.DefaultImageKey); this.listAvailableActions.Items.Add(item); } if (index >= this.listCurrentActions.Items.Count) { index--; } this.listCurrentActions.SelectedIndex = index; this.Changed = true; }
private void CreateListCommands(IEnumerable <ToolbarCommand> toolbars) { this.CreateListCurrentCommands(toolbars); this.listAvailableActions.Items.Clear(); KryptonListItem item = new KryptonListItem(separator); item.Image = new Bitmap(16, 16); this.listAvailableActions.Items.Add(item); foreach (Command cmd in this.commands.Keys) { if (!this.IsCurrentCommand(cmd)) { item = new KryptonListItem(this.commands[cmd].Text); item.Tag = cmd; if (string.IsNullOrEmpty(cmd.ImageKey)) { item.Image = new Bitmap(16, 16); } else { item.Image = CommandImageCollection.GetImage(cmd.DefaultImageKey); } this.listAvailableActions.Items.Add(item); } } }
public ImagesDialog() { InitializeComponent(); this.images = new CommandImageCollection(); foreach (CommandImage imageData in this.images) { if (imageData.Size == 16) { Image im = CommandImageCollection.GetImage(imageData.Name); this.imageList.Images.Add(imageData.Name, im); } } foreach (string category in this.images.Categories) { this.comboCategory.Items.Add(category); } this.comboCategory.SelectedIndex = 0; }
private void CreateToolbarButtons() { this.toolStripMain.Items.Clear(); this.toolStripMain.Visible = database.Opened && MainForm.Config.App.Main.ViewToolBar && this.toolbars.Count > 0; foreach (ToolbarCommand cmd in this.toolbars.Commands) { if (cmd.Command.IsSeparator) { this.toolStripMain.Items.Add(new ToolStripSeparator()); } else { ToolStripMenuItem menu = this.menuCommands[cmd.Command]; ToolStripButton button = new ToolStripButton(menu.Text); button.Image = CommandImageCollection.GetImage(cmd.Command.ImageKey); this.toolStripMain.Items.Add(button); button.Click += delegate { menu.PerformClick(); }; menu.Image = CommandImageCollection.GetImage(cmd.Command.ImageKey); } } }
private void CreateListCurrentCommands(IEnumerable <ToolbarCommand> toolbars) { this.listCurrentActions.Items.Clear(); this.styles.Clear(); KryptonListItem item; foreach (ToolbarCommand cmd in toolbars) { if (cmd.Command.IsSeparator) { item = new KryptonListItem(separator); } else { item = new KryptonListItem(this.commands[cmd.Command].Text); item.Tag = cmd.Command; } if (string.IsNullOrEmpty(cmd.Command.ImageKey)) { item.Image = new Bitmap(16, 16); } else { if (this.changedImages.ContainsKey(cmd.Command)) { item.Image = CommandImageCollection.GetImage(this.changedImages[cmd.Command]); } else { item.Image = CommandImageCollection.GetImage(cmd.Command.ImageKey); } } this.listCurrentActions.Items.Add(item); this.styles.Add(cmd.Command, cmd.DisplayStyle); } }
private void ButtonChangeIconClick(object sender, EventArgs e) { KryptonListItem item = (KryptonListItem)this.listCurrentActions.SelectedItem; if (item.Tag != null) { Command cmd = (Command)item.Tag; string newImage = ImagesDialog.Show(); if (!string.IsNullOrEmpty(newImage)) { item.Image = CommandImageCollection.GetImage(newImage); if (this.changedImages.ContainsKey(cmd)) { this.changedImages[cmd] = newImage; } else { this.changedImages.Add(cmd, newImage); } } this.Changed = true; } }