导航:首页 > 编程知识 > 图形化编程中如何把一个物体放大

图形化编程中如何把一个物体放大

发布时间: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;
}
}

阅读全文

与图形化编程中如何把一个物体放大相关的资料

热点内容
计算机连成网络的最重要优势是 浏览:411
优盘打开后文件夹为空 浏览:495
实时数据写入量大如何优化 浏览:76
哪里能学程序编程 浏览:647
微信里面的文件储存在哪个目录 浏览:745
高仿苹果5s屏幕显示清楚吗 浏览:897
若有以下程序void 浏览:432
大数据主体有哪些 浏览:961
如何学习编程的优点 浏览:906
最新版本手机qq 浏览:463
简述在word 浏览:528
qq怎么清楚历史记录防止被盗 浏览:263
发送手机里的录音文件在哪里 浏览:866
js获取下一个兄弟元素 浏览:293
js模板引擎原理 浏览:72
linuxo文件运行 浏览:713
什么免费备份数据 浏览:342
测量大师导入底图找不到文件 浏览:313
小红伞安装程序要求版本6 浏览:799
全民k歌pcm文件夹 浏览:224

友情链接