我正在尝试使用Bitmap但我得到即时错误 尝试使用System.Drawing.Bitmap来支付 并继续获取 错误CS0246无法找到类型或命名空间名称'Bitmap'(您是否缺少using指令或程序集引用?)BitMap D:\ Data\3M Machines\Mh Machines\Programmation Project \C#\ BitMap \ BitMap \ Program.cs 13活动 我尝试了什么: 不多,我不明白该怎么做。
I am trying to use Bitmap but I get instant error trying using System.Drawing.Bitmap and keep getting Error CS0246 The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?) BitMap D:\Data\3M Machines\My Machines\Programmation Project\C#\BitMap\BitMap\Program.cs 13 Active What I have tried: Not much, I don't understand what to do.
推荐答案你只在使用中包含命名空间,而不是类名 You only include the namespace in the "using", not the class name using System.Drawing
如果你在努力创建课程,那你真的很难努力做更先进的事情。我会得到一本关于c#的书,然后开始学习基础知识,然后继续学习其他内容。
If you're struggling to even create a class you're really going to struggle doing anything more advanced. I'd get a book on c# and start learning the basics before moving on to anything else.
你没有使用单个类的语句,只是它们所在的命名空间: You don't add a using statement for individual classes, just the namespace they are in: using System.Drawing;
然后你可以使用这个类:
You can then use the class:
Bitmap bm = (Bitmap) Bitmap.FromFile(@"D:\Temp\MyImage.bmp");
更多推荐
如何在C#中使用位图
发布评论