如何在C#中使用位图

编程入门 行业动态 更新时间:2024-10-25 14:32:22
本文介绍了如何在C#中使用位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用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#中使用位图

本文发布于:2023-11-03 06:42:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1554478.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位图   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!