- 关 键 词:
- .net
//// <summary>
/// 按比例缩小图片,自动计算宽度
/// </summary>
/// <param name="strNewPic">缩小后保存为文件名(包括路径)</param>
/// <param name="intHeight">缩小至高度</param>
public void SmallPicWidth(string strOldPic, string strNewPic, int intHeight)
{
System.Drawing.Bitmap objPic, objNewPic;
try
{
objPic = new System.Drawing.Bitmap(strOldPic);
int intWidth = (intHeight / objPic.Height) * objPic.Width;
objNewPic = new System.Drawing.Bitmap(objPic, intWidth, intHeight);
objNewPic.Save(strNewPic);
}
catch (Exception exp) { throw exp; }
finally
{
objPic = null;
objNewPic = null;
}
}
/**//// <summary>
/// 缩小图片
/// </summary>
/// <param name="strOldPic">源图文件名(包括路径)</param>
/// <param name="strNewPic">缩小后保存为文件名(包括路径)</param>
/// <param name="intWidth">缩小至宽度</param>
/// <param name="intHeight">缩小至高度</param>
public void SmallPic(string strOldPic, string strNewPic, int intWidth, int intHeight)
{
System.Drawing.Bitmap objPic, objNewPic;
try
{
objPic = new System.Drawing.Bitmap(strOldPic);
objNewPic = new System.Drawing.Bitmap(objPic, intWidth, intHeight);
objNewPic.Save(strNewPic);
}
catch (Exception exp)
{ throw exp; }
finally
{
objPic = null;
objNewPic = null;
}
}
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- .NET移动与嵌入式技术 (6032篇文章)
- .NET开发手册 (5722篇文章)
- 加速有理 迅雷超速下载13秘技 (218次浏览)
- 强悍!脱兔实用技巧大放送 (143次浏览)
- 快车VS迅雷 下载速度火拼实测 (107次浏览)
- DIY自己的绿色版迅雷下载 (33次浏览)
- 使用eMule电驴过程中常遇的10个问题及解决 (22次浏览)
- 轻轻松松批量下载相册中的照片 (22次浏览)
- 快车2.0 Beta 6新版发动BT提速革命 (19次浏览)
- P2P下载中 保护系统安全的五大步骤 (18次浏览)
- 教你自己动手制作绿色版迅雷 (17次浏览)
- 体验漫步家Pronto!的酷棒通和P2P功能 (15次浏览)



