Ejemplo n.º 1
0
        private void IconExtractor_Load(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                Close();
            }

            try
            {
                var icons = IconExtractor.ExtractIconsFromExe(openFileDialog1.FileName);
                var i     = 0;
                listView1.BeginUpdate();
                foreach (var icon in icons)
                {
                    var item = new ListViewItem("Icon #" + i.ToString());
                    imageList1.Images.Add(icon);
                    item.ImageIndex = i;
                    item.Tag        = icon;
                    listView1.Items.Add(item);
                    i++;
                }
                listView1.EndUpdate();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to extract icons from executable: " + ex.Message, "Error extracting icons", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
            }
        }
Ejemplo n.º 2
0
 public SelectIconDialog(string filename)
 {
     this.icons = IconExtractor.ExtractIconsFromExe(filename);
     InitializeComponent();
     Font = SystemFonts.MessageBoxFont;
 }