void Button1Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Resource File|*.exe;*.dll"; if (ofd.ShowDialog() == DialogResult.OK) { this.textBox1.Text = ofd.FileName; try{ tIcons = CatchHandler.IconsFromFile(ofd.FileName, IconSize.Large); } catch (Exception ex) { this.label3.Text = "0"; return; } indexs = tIcons.Length; this.label3.Text = indexs.ToString(); if (indexs == 0) { return; } index = 0; tIcon = tIcons[index]; this.pictureBox1.Image = tIcon.ToBitmap(); } }
void Button2Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Icon file|*.ico"; if (sfd.ShowDialog() == DialogResult.OK) { CatchHandler.SaveIcon(tIcon, sfd.FileName); } }