導航:首頁 > 編程知識 > 圖形化編程中如何把一個物體放大

圖形化編程中如何把一個物體放大

發布時間:2023-08-09 18:33:17

1. c#如何放大縮小、移動、旋轉圖片,沒搞過圖像編程,找朋友們幫忙!

/// <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;
}
}
/// <summary>
/// 按比例縮小圖片,自動計算高度
/// </summary>
/// <param name="strOldPic">源圖文件名(包括路徑)</param>
/// <param name="strNewPic">縮小後保存為文件名(包括路徑)</param>
/// <param name="intWidth">縮小至寬度</param>
public void SmallPic(string strOldPic, string strNewPic, int intWidth)
{
System.Drawing.Bitmap objPic,objNewPic;
try
{
objPic = new System.Drawing.Bitmap(strOldPic);
int intHeight=(intWidth / objPic.Width) * objPic.Height;
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="intHeight">縮小至高度</param>
public void SmallPic(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;
}
}

閱讀全文

與圖形化編程中如何把一個物體放大相關的資料

熱點內容
淘寶網路電話叫什麼 瀏覽:231
編程要讀哪些書 瀏覽:134
如何在手機上新建文件夾里添文件 瀏覽:292
先鋒w10刷安卓系統 瀏覽:787
java設置過期日期 瀏覽:114
新版本抖音怎麼看我的數據比例 瀏覽:946
什麼是3G網路3G的發展史 瀏覽:269
如何使用ps把圖片的文件大小弄小 瀏覽:880
安卓系統根目錄文件夾 瀏覽:900
手錶怎麼設置蜂窩網路 瀏覽:51
舊愛勾搭app還有嗎 瀏覽:141
日外語言編程軟體哪個好 瀏覽:950
小論文發表了但是數據錯誤怎麼辦 瀏覽:952
注冊表禁止啟動程序運行 瀏覽:705
網路優化總體流程圖 瀏覽:735
前端程序員簡歷模板 瀏覽:706
蜂巢積木編程機器人怎麼樣 瀏覽:561
微信小程序tips 瀏覽:117
油印文件有哪些 瀏覽:854
java線程買票案例 瀏覽:672

友情鏈接