我在哪里可以找到System.Windows.Media?媒体不存在

时间:2013-04-18 15:24:12

标签: c#

我试过了:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using AviFile;
using ScreenShotDemo;
using System.Threading;
using System.Windows.

在我的新班级,但在底层系统.Windows。 没有媒体

我正在使用visual c#pro 2012和.net 4.5 试图添加它作为参考在.net和COM中寻找它,但它不存在。

我需要它的原因是在我的代码中我有PixelFormat并且它不存在:

Bitmap bmpScreenShot = new Bitmap(currentScreen.Bounds.Width,
currentScreen.Bounds.Height,
PixelFormat.Format32bppArgb);

PixelFormat不存在。

3 个答案:

答案 0 :(得分:5)

您需要将System.Drawing.Imaging添加到using语句中。

您可以通过右键点击相关项目并选择“解决”来轻松找到您需要包含的内容

答案 1 :(得分:3)

我正在写这个答案,就像我一样,花了好几个小时试图找到using System.Windows.Media,并且无法获得BitmapImage。只需使用using Windows.UI.Xaml.Media.Imaging即可。它运作得很好。

答案 2 :(得分:2)

System.Windows.Media需要引用PresentationCore.dll和

Pixelformat需要引用System.Drawing.dll。

参见参考here