最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

.Net實(shí)現(xiàn)上傳圖片按比例自動(dòng)縮小或放大的方法

 更新時(shí)間:2014年09月02日 09:19:18   投稿:shichen2014  
這篇文章主要介紹了.Net實(shí)現(xiàn)上傳圖片按比例自動(dòng)縮小或放大的方法,實(shí)例內(nèi)容簡潔功能實(shí)用,需要的朋友可以參考下

本文實(shí)例主要展示了.Net實(shí)現(xiàn)上傳圖片按比例自動(dòng)縮小或放大的方法,是非常實(shí)用的功能。分享給大家供大家參考之用。具體方法如下:

//// <summary>
/// 按比例縮小圖片,自動(dòng)計(jì)算寬度
/// </summary>
/// <param name="strOldPic">源圖文件名(包括路徑)</param>
/// <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;
  }
}

希望本文所述實(shí)例對大家的asp.net程序設(shè)計(jì)有一定的借鑒價(jià)值。

相關(guān)文章

最新評論

菏泽市| 五常市| 和政县| 栾城县| 崇义县| 那曲县| 新化县| 三江| 日喀则市| 资阳市| 沛县| 开远市| 益阳市| 寻乌县| 利津县| 冀州市| 浮梁县| 榆林市| 颍上县| 建宁县| 汕尾市| 城固县| 仪陇县| 泗洪县| 山东省| 苗栗市| 镶黄旗| 蒙自县| 阿克陶县| 绍兴市| 万源市| 安吉县| 健康| 新龙县| 林甸县| 三门县| 布尔津县| 闽清县| 金溪县| 普安县| 汾阳市|