简体   繁体   English

C#WPF项目中缺少“位图”命名空间

[英]Missing “Bitmap” namespace in C# WPF project

I need to use "Bitmap" from namespace "System.Drawing" but there is nothing like this . 我需要使用名称空间“ System.Drawing”中的“ Bitmap”,但没有这样的东西。 If I create "Windows forms Application" there is not a problem like this. 如果我创建“ Windows窗体应用程序”,则不会出现这样的问题。

How to use this "Bitmap" in my WPF project (add namespace that contains Bitmap class)? 如何在我的WPF项目中使用此“位图”(添加包含Bitmap类的名称空间)? I use Microsoft Visual Studio 2015 RC. 我使用Microsoft Visual Studio 2015 RC。

This is my problem. 这是我的问题。 System.Drawing not contain "Bitmap" namespace in WPF project, but when i create Windows Forms application there is Bitmap. System.Drawing在WPF项目中不包含“位图”命名空间,但是当我创建Windows窗体应用程序时,会出现位图。

This is because WinForm has a reference to System.Drawing by default but WFP doesn't. 这是因为WinForm默认情况下具有对System.Drawing的引用,但WFP没有。 So you need to add this reference manually (right-click on Solution Explorer -> References -> Add Reference ... ). 因此,您需要手动添加此引用(在解决方案资源管理器->引用->添加引用...上单击鼠标右键)。

Look at this information: namespace to use in your class file is System.Drawing and refrence that you need to have is System.Drawing . 查看此信息:在类文件中使用的名称空间是System.Drawing,而需要的引用是System.Drawing。

Namespace: System.Drawing Assembly: System.Drawing (in System.Drawing.dll) 命名空间:System.Drawing程序集:System.Drawing(在System.Drawing.dll中)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM