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

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

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

閱讀全文

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

熱點內容
網路中常用的傳輸介質 瀏覽:518
文件如何使用 瀏覽:322
同步推密碼找回 瀏覽:865
樂高怎麼才能用電腦編程序 瀏覽:65
本機qq文件為什麼找不到 瀏覽:264
安卓qq空間免升級 瀏覽:490
linux如何刪除模塊驅動程序 瀏覽:193
at89c51c程序 瀏覽:329
怎麼創建word大綱文件 瀏覽:622
裊裊朗誦文件生成器 瀏覽:626
1054件文件是多少gb 瀏覽:371
高州禁養區內能養豬多少頭的文件 瀏覽:927
win8ico文件 瀏覽:949
仁和數控怎麼編程 瀏覽:381
項目文件夾圖片 瀏覽:87
怎麼在東芝電視安裝app 瀏覽:954
plc顯示數字怎麼編程 瀏覽:439
如何辨別假網站 瀏覽:711
寬頻用別人的賬號密碼 瀏覽:556
新app如何佔有市場 瀏覽:42

友情鏈接