日期:2014-05-17 浏览次数:20756 次
private void btnSetSmallArrow_Click(object sender, EventArgs e) { RegistryKey rKey = Registry.LocalMachine; RegistryKey rSetSmallArrow = rKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", true); rSetSmallArrow.CreateSubKey("Shell Icons"); rSetSmallArrow = rKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", true); File.Copy("Arrow.ico", "C:\\Windows\\Arrow.ico",true);//在移植到别的电脑上报错,如何将图片嵌入程序中呢? rSetSmallArrow.SetValue("29", "C:\\Windows\\Arrow.ico,0", RegistryValueKind.String); rSetSmallArrow.Close(); rKey.Close(); Process[] myPr; myPr = Process.GetProcessesByName("explorer"); foreach (Process mypr in myPr) { mypr.Kill(); } MessageBox.Show("修改成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); }