资 源 简 介
翻译 maninwest@Codeforge 作者: Md. Marufuzzaman @ Codeproject在web/Windows 应用程序中添加图像/签名很常用。这里介绍如何调整图像大小并保持图像质量。使用代码我写了个函数来调整大小 (即 “ImageResize”)。这个函数有 4 个参数:strImageSrcPath: 包含源文件路径的字符串 strImageDesPath: 包含目标文件路径的字符串 intWidth: 新图像宽度的整型值 intHeight : 新图像高度整型值 使用有效输入成功调用函数后,图像的大小将被调整,图像存储在目标路径下,返回新文件的全路径。 我在这里使用了 .NET framework 3.5 (System.Drawing,IO) 命名空间. Public Function ImageResize(ByVal strImageSrcPath As String _
, ByVal strImageDesPath As String _
, Optional ByVal intWidth As Integer = 0 _
, Optional ByVal intHeight As Integer = 0) As String
If System.IO.File.Exists(strImageSrcPath) = False Then Exit Function