如何使用c#压缩包含图像的文件夹 [英] how to compressed folder containing images using c#

查看:77
本文介绍了如何使用c#压缩包含图像的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

i想要我可以浏览文件夹到文本框,并保存文件夹应根据用户定义大小的图像压缩到特定目录。

hello
i wants such that i can browse folder to the textbox and by saving it the folder should be compressed as per user define sized images to the particular directory.

推荐答案

我们在CP中有一篇很好的文章 C#Zip文件和/或文件夹 [ ^ ]检查文件/文件夹压缩。
we have a nice article in CP C# Zip Files and/or Folders[^] check this out for File/Folder Compression.


使用DotNetZip。



示例代码:

use DotNetZip.

Sample code:
using (ZipFile zip = new ZipFile())
{
    zip.AddFile("C:\\file1.docx");
    zip.AddFile("C:\\file2.pdf");
    zip.AddFile("C:\\file3.xlsx");
    zip.Save("C:\\MyZip.zip");
}



http://dotnetzip.codeplex.com/ [ ^ ]


这篇关于如何使用c#压缩包含图像的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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