2011-12-21 25 views
0

Windows XP Service Pack 3を実行しています。Visual Studio 2010. C#プロジェクト。PresentationCore.dllが参照されていても "using System.Windows.Media"の認識されない

私は「System.Windows.Mediaを使用する」とクラスのプロジェクトで「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); 
     } 

    } 
} 
+0

http://social.msdn.microsoft.com/Forums/en-US/windowswic/thread/fdfff143-c1ae-41cd-bbeb-8ff6c1c879ecは、いくつかの手がかりを持っています。 –

+0

タイトルに「Visual Studio .NET:」などのプレフィックスを付けないでください。それが[so]のタグに使われているものです。 –

答えて

1

まず、メソッドが静的であっても、メソッドをクラスとは別に配置することはできません。そのような何かを試してみてください。

namespace TestProject 
    { 
     public partial class App : Application 
     { 
      public void Init() 
      { 
       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); 
      } 
     } 
    } 
} 
+0

.NETバージョン4. WindowsBaseが既に追加されていて、同じ問題が発生します。 –

+0

私はコードをカットアンドペーストしようとしました。しかし、このウェブサイトの書式設定規則は、それ自体のプログラミング言語です。それは私がカットアンドペーストすることができないので、コードを投稿することはできません。私はあなたにコードを電子メールで送ることができます。それは大丈夫ですか? –

+0

問題はありませんが、コードを待ちます。私は、XP SP3がインストールされたマシンを持っているので、あなたのコードに何が問題なのかを簡単に確認することができます。 – Kath

関連する問題