我運行的是Windows XP Service Pack 3. Visual Studio 2010. C#項目。「使用System.Windows.Media」即使PresentationCore.dll被引用也無法識別
我在類項目中包含了「Using System.Windows.Media」和「Using System.Windows.Media.Imaging」。我還添加了PresentationCore.dll參考。這是在解決方案窗口完成的。
所謂的「智能感知」是對來自這些命名空間的所有功能進行重新排列。我沒有做任何修復。爲什麼編譯器不能識別PresentationCore參考?
我需要解決這個問題FAST。
謝謝任何善意幫助我的人。
using System.Windows
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace TextEditor
{
public partial class App : Application
{
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionOccurred;
}
private static void UnhandledExceptionOccurred(object sender, UnhandledExceptionEventArgs e)
{
Window win = Current.MainWindow;
RenderTargetBitmap bmp = new RenderTargetBitmap((int) win.Width, (int) win.Height, 96, 96, PixelFormats.Pbgra32);
bmp.Render(win);
string errorPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ErrorReports");
if(!Directory.Exists(errorPath))
Directory.CreateDirectory(errorPath);
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmp));
string filePath = Path.Combine(errorPath, string.Format("{0:MMddyyyyhhmmss}.png", DateTime.Now));
using(Stream stream = File.Create(filePath))
{
encoder.Save(stream);
}
}
}
http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/fdfff143-c1ae-41cd-bbeb-8ff6c1c879ec有一些線索。 – 2011-12-21 05:40:54
請不要在「Visual Studio .NET:」等標題前添加前綴。那是什麼標籤用於[所以]。 – 2011-12-21 21:47:24