简体   繁体   English

如何使用 C# .Net Compact Framework 打开图像并编辑图像。

[英]How can I open an image and edit the image with C# .Net Compact Framework.

Is it possible to open an image and edit that image by drawing on the image, means loading an image and just making some scratches on it like we can do that in Windows Paint.是否可以通过在图像上绘制来打开图像并编辑该图像,这意味着加载图像并在其上做一些划痕,就像我们在 Windows Paint 中可以做到的那样。

How can I do that in .Net Compact Framework using C# ?我如何使用 C# 在 .Net Compact Framework 中做到这一点?

Of course you can.当然可以。 Simply open the image using Image.FromFile() , then create a Graphics object against this image by using Graphics.FromImage() and then use GDI+ methods like DrawLine() , DrawRectangle() , DrawString() etc. to make changes to it.只需使用Image.FromFile()打开图像,然后使用Graphics.FromImage()针对该图像创建一个Graphics对象,然后使用 GDI+ 方法如DrawLine()DrawRectangle()DrawString()等对其进行更改. At the end, use Image.Save() function to save your changes back to the file.最后,使用Image.Save()函数将更改保存回文件。

Something on the following lines:以下几行内容:

Image img = Image.FromFile("<FILE_PATH>");
using (Graphics g = Graphics.FromImage(img))
    g.DrawLine(Pens.Black, 10,10, 20,20);
img.Save("<FILE_PATH>");

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

相关问题 在C#中的.NET Compact Framework中旋转图像的快速方法 - Fast method to rotate image in .NET Compact Framework in C# 如何使用C#Win Mobile 6.5 / Compact框架从图像创建缩略图? - How do I create a thumbnail from an image using C# Win Mobile 6.5/Compact framework? 如何在Compact Framework中将图像图标添加到标题栏并隐藏底部栏? - How to add image icon to title bar and hide bottom bar in Compact Framework.? 我怎么可以转换使用StandardInput和StandardOutput在.NET Compact Framework的C#应用​​程序? - How can I convert a C# application that uses StandardInput and StandardOutput in .NET Compact Framework? C# 如何使用 .Net Framework 关闭打开的文件? - C# How can I close an open file with .Net Framework? 保存图像时在C#紧凑框架中的IOEXCEPTION - IOEXCEPTION in C# compact framework when saving image c#如何检查表单是否已在紧凑框架中打开 - c# how check if the form is already open in compact framework 如何在 C# 中编辑图像 - How to edit image in C# C#.NET如何在WebBrowser控件上显示图像? - C# .NET How can I show an image on WebBrowser control? 如何在C#中隐藏沙漏图标(.NET Compact Framework) - How to hide the hourglass icon in C# (.NET Compact Framework)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM