应用程序如何使用图片呢?
我的问题是这样的:
有如下代码:有一句是复制一个.ico文件到C:\windows目录下边。这个.ico文件在我编译程序时在我的程序Debug目录下边,编译好的程序可以正常运行。但是当我把程序移植到别的电脑上就提示无法找到图片路径。我现在想知道如何将这个.ico文件加到程序里面一遍在别的电脑上也可以正常运行。
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); }