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

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

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

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

//// <summary>
/// 按比例縮小圖片,自動計算寬度
/// </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;
  }
}

希望本文所述實例對大家的asp.net程序設計有一定的借鑒價值。

相關文章

最新評論

卓资县| 华蓥市| 石河子市| 许昌县| 河南省| 南昌市| 尉犁县| 西城区| 大庆市| 庄河市| 临洮县| 凌海市| 栾城县| 铜梁县| 深水埗区| 祥云县| 嘉黎县| 阜康市| 彭泽县| 东城区| 尉氏县| 科技| 玛曲县| 鄱阳县| 临猗县| 沾化县| 侯马市| 鄱阳县| 益阳市| 庄浪县| 临海市| 桂林市| 新和县| 山西省| 邵阳市| 合阳县| 汝阳县| 即墨市| 昭平县| 盐津县| 临洮县|