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

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

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

閱讀全文

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

熱點內容
圖片傳入iphone 瀏覽:730
rs485雙機通信程序 瀏覽:967
怎麼托日本的朋友買蘋果手機 瀏覽:145
築業電力軟體怎麼倒出文件 瀏覽:572
全民飛機大戰軍銜怎麼升級 瀏覽:431
公司自動化編程屬於什麼 瀏覽:925
位位用車app在哪裡下載 瀏覽:427
格式工廠iphone鈴聲 瀏覽:171
linux設置字元編碼 瀏覽:15
帝王世紀升級哪個兵種 瀏覽:409
c編程開發軟體是什麼 瀏覽:334
二的大寫怎麼寫app 瀏覽:612
樂視數據刪除了怎麼找回來 瀏覽:651
ug編程初始化怎麼辦 瀏覽:295
nginxajax配置文件 瀏覽:467
小程序獲取二進制圖片 瀏覽:206
為什麼有的數控車編程有百分號 瀏覽:425
m文件有什麼用 瀏覽:359
宜昌做投標文件多少錢 瀏覽:166
uc瀏覽器小說下載那個文件夾 瀏覽:908

友情鏈接