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

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

發布時間: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;
}
}

閱讀全文

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

熱點內容
編程壓縮後怎麼發送 瀏覽:289
java做的客戶端 瀏覽:332
文泰文件圖片 瀏覽:429
最出名的果汁app 瀏覽:183
什麼綜藝都能看的影視app 瀏覽:904
蘋果7無限重啟開機畫面 瀏覽:223
賓士更換倒車雷達模塊如何編程 瀏覽:246
江蘇密碼文件櫃價格是多少 瀏覽:997
禾木app有哪些 瀏覽:758
看韓國19禁電影的微信 瀏覽:290
java最好用的框架 瀏覽:208
微視文件路徑 瀏覽:746
國內網路新聞有哪些 瀏覽:697
au的sesx文件路徑 瀏覽:479
微信轉發不涉密文件 瀏覽:795
手機文件在哪打開 瀏覽:249
瓮怎麼讀app 瀏覽:978
如何把文件傳送到小米手錶 瀏覽:695
如何刪除映像文件的快捷方式 瀏覽:483
如何用數據解析未來的趨勢 瀏覽:656

友情鏈接