0
我想清除位圖圖像。我都試過C#清除BitmapImage或其實例
uploadImage.Source = null;
和
uploadImage.Source = "";
這是我用來使圖像的代碼:
// BitmapImage.UriSource must be in a BeginInit/EndInit block
BitmapImage myBitmapImage = new BitmapImage();
string curItem = destinationFolder + "\\" + listBox1.SelectedItem.ToString();
myBitmapImage.BeginInit();
myBitmapImage.UriSource = new Uri(@curItem);
myBitmapImage.DecodePixelWidth = 200;
myBitmapImage.EndInit();
uploadImage.Source = myBitmapImage;
'uploadImage'是什麼類型?也許它有一個'.Clear()'方法? – Timwi 2010-08-19 02:05:28
uploadImage是Image類型的。沒有Clear()方法。 – 2010-08-19 05:40:39