代码如下:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Resources;
using System.Reflection;
using System.Runtime.InteropServices;
namespace newExtIcon
{
    public partial class MainForm : Form
    {    
        public Assembly asm = Assembly.GetExecutingAssembly();
        public MainForm()
        {
            InitializeComponent();        
        }
        void MainForm_Load(object sender ,EventArgs e)
        {
            lbl_display.Text ="No Work !";    
        }
        void btnExtractClick(object sender, EventArgs e)
        {
            Random rd = new Random();
            openFileDialog1.Filter="应用程序|*.dll;*.exe|所有程序|*.*";
            if(openFileDialog1.ShowDialog()== DialogResult.OK)
            {
                Icon icon = Icon.ExtractAssociatedIcon(openFileDialog1.FileName);
                FileStream fileStream = new FileStream("d://"+rd.Next(1,100000)+".ico",FileMode.Create);
                icon.Save(fileStream);
                fileStream.Close();        
                lbl_display.Text="Work Done!";
            }
            else
            {
                return ;
            }
        }
        void BtnChangeClick(object sender, EventArgs e)
        {
            Size sz = new Size(32,32);            
新闻热点
疑难解答
图片精选