如何在C#中使用位图 [英] How to use bitmap in C#

查看:355
本文介绍了如何在C#中使用位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Bitmap但我得到即时错误



尝试使用System.Drawing.Bitmap来支付




并继续获取

错误CS0246无法找到类型或命名空间名称'Bitmap'(您是否缺少using指令或程序集引用?)BitMap D:\ Data\3M Machines\Mh Machines\Programmation Project \C#\ BitMap \ BitMap \ Program.cs 13活动



< b>我尝试了什么:



不多,我不明白该怎么做。

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#中使用位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆