如何将位图转换为图标 [英] How to convert bitmap to icon
本文介绍了如何将位图转换为图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将我的图像从picturebox存储到数据库
但是在我加载了我的datagrod视图列之后,由于图片大而得到的图像非常大,所以我想将我的位图存储为图标怎么做这个
这是我的代码
if (picFoto.Image!= null )
{
位图bmp = new 位图(picFoto.Image);
/// / Icon icon = System.Drawing.Icon.FromHandle(bmp.GetHicon());
System.IO.MemoryStream imgMemoryStream = new System.IO.MemoryStream();
bmp.Save(imgMemoryStream,System.Drawing.Imaging.ImageFormat.Jpeg);
byte [] imgByteData = imgMemoryStream.GetBuffer();
row [ Foto] = imgByteData;
}
解决方案
看看这个:
1. 一个简单的类,可以将图像转换为c#中的图标 [ ^ ]
2. 使用C#将图像文件转换为图标 [ ^ ]
我认为你的意思是你要生成缩略图而不是图标
在MSDN网站上查看这篇文章如何:创建缩略图 [ ^ ]
本文介绍如何将位图转换为图标
http://www.go4expert.com/articles/convert-image-icon-c-sharp-t19250/ [ ^ 一>
I m storing my image from picturebox to database
But after i load my datagrod view column fo image get very large because of large picture , so i want to store my bitmap as icon how to do this
Here is my code
if (picFoto.Image != null)
{
Bitmap bmp = new Bitmap(picFoto.Image);
//// Icon icon = System.Drawing.Icon.FromHandle(bmp.GetHicon());
System.IO.MemoryStream imgMemoryStream = new System.IO.MemoryStream();
bmp.Save(imgMemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] imgByteData = imgMemoryStream.GetBuffer();
row["Foto"] = imgByteData;
}
解决方案
Check this out:
1. A simple class that converts a image to a icon in c# [^]
2. Convert Image file to Icon using C#[^]
I think you mean you want to generate a thumbnail image rather than an icon
Have a look at this article on the MSDN website How to: Create Thumbnail Images[^]
This article describes how to convert a bitmap to an icon
http://www.go4expert.com/articles/convert-image-icon-c-sharp-t19250/[^]
这篇关于如何将位图转换为图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文