访问WP7 Silverlight App项目上的图像

时间:2012-02-21 22:15:26

标签: c# windows-phone-7

在我的WP7 App / Silverlight项目中,我得到了一些我想在运行WP7应用程序时访问的图像。这可能吗?

我的意思是 - 例如。

我正在将MyImages文件夹创建到我的项目中。 我把那里放了几个.png,例如1.png,2.png等。

我运行应用程序(编译等)

我可以修改这些文件吗?例如,保存不同的内容

MyImages / 1.png

某种覆盖此文件?

---------------------------- ADDED

using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (myIsolatedStorage.FileExists(fileName))
                {
                    myIsolatedStorage.DeleteFile(fileName);
                }

                IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(fileName);
                BitmapImage bitmap = new BitmapImage();
                bitmap.SetSource(imageStream);

                WriteableBitmap wb = new WriteableBitmap(bitmap);
                wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);

                MessageBox.Show(imageStream.ToString());

                fileStream.Close();
            }

1 个答案:

答案 0 :(得分:1)

是的,你可以here是一篇很好的文章