保存在WPF后图像不显示

时间:2014-06-02 10:17:58

标签: wpf image

我正在尝试保存项目图标,保存后我需要在下一页显示,但它没有显示。每次我需要首先在项目中包含该图像,然后重建项目然后它变得可见。 我正在使用以下代码。请告诉我我在哪里做错了我想要新保存的图像将自动包含在项目中

string imagename = imagebind1.Source.ToString();
int indxofslash = imagename.LastIndexOf('/');
string substribgimgname = imagename.Substring(indxofslash + 1).ToString();
string imagename1 = "/img/icons/" + System.IO.Path.GetFileName(imagename);
String appStartPath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
string folderpath = System.IO.Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + "\\img\\icons\\";
if (!Directory.Exists(folderpath))
{
    Directory.CreateDirectory(folderpath);
}
string filePath = folderpath + substribgimgname;
string localPath = new Uri(imagename).LocalPath;

System.IO.File.Copy(localPath, filePath, true);

0 个答案:

没有答案