private void SelectImage(PictureBox pictureBox) { _imgChanged = OpenIconDialog.ShowDialog(this) == DialogResult.OK; if (_imgChanged) { pictureBox.SizeMode = Constants.defaultPictureSizeMode; pictureBox.Image = Image.FromFile(OpenIconDialog.FileName); _fileName = OpenIconDialog.FileName.Split('\\').Last(); } }
private void toolStripMenuItemBrowseIcon_Click(object sender, EventArgs e) { if (treeView.SelectedNode == null) { return; } if (treeView.SelectedNode.Tag == null) { return; } ItemProperty tag = (ItemProperty)treeView.SelectedNode.Tag; OpenIconDialog dlg = new OpenIconDialog(); if (tag.HasIcon()) { dlg.IconFile = tag.IconFile; } else { dlg.IconFile = tag.Command; } dlg.IconIndex = tag.IconIndex; if (dlg.ShowDialog(this.Handle) == DialogResult.Cancel) { return; } tag.IconFile = dlg.IconFile; tag.IconIndex = dlg.IconIndex; //Icon selectedIcon = IconManager.GetIcon(dlg.IconFile, dlg.IconIndex, false); //imageList.Images.Add(selectedIcon); //selectedIcon.Dispose(); treeView.SelectedNode.ImageKey = imageList_AddIcon(tag.IconFile, tag.IconIndex); treeView.SelectedNode.SelectedImageKey = treeView.SelectedNode.ImageKey; UpdateInfoPanel(); }