How to implement picture zoom in C #

xiaoxiao2021-03-06  87

// ******************************************************** *********** //// The following is given three simple methods, and the following two methods are extensions, and it is estimated that sometimes use // ********** ********************************************************* / / ///

/// 小 图片 /// Source diagram file name (including path) /// Save as file name (including path) /// zoom to the width /// shrink to height < / param> public void smallpic (string stroldpic, string strnewpic, int inTwidth, int tent) {

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;}}

///

/// A reduced picture, automatically calculate the height /// /// source diagram file name (including path) /////// Save as file name (including path) /// shrink to width public void smallpic (String StroldPic, String StrnewPic) INT INTWIDTH) {

System.Drawing.Bitmap objPic, objNewPic; try {objPic = new System.Drawing.Bitmap (strOldPic); int intHeight = Convert.ToInt32 (((intWidth * 1.0) / (objPic.Width * 1.0)) * objPic.Height) ObjnewPic = new system.drawing.bitmap (objPic, intWidth, INTHEIGHT); ObjnewPic.save (strnewpic, objpic.rawformat);

} CatCH (Exception Exp) {throw Exp;} Finally {ObjPic = NULL; ObjneWPic = NULL;}}

/ * ///

///Adrow the picture, automatically calculate the width /// /// Source diagram file name (including path) / // Save as file name (including path) /// shrink to height public void smallpic (String StroldPic, String strNewPic, int intHeight) {System.Drawing.Bitmap objPic, objNewPic; try {objPic = new System.Drawing.Bitmap (strOldPic); int intWidth = Convert.ToInt32 (((intHeight * 1.0) / objPic.Height) * objPic. Width; objnewpic = new system.drawing.bitmap (objPic, intWidth, INTHEIGHT); ObjnewPic.save (strnewpic, objpic.rawformat);

} CatCH (Exception Exp) {throw Exp;} Finally {ObjPic = NULL; ObjneWPic = NULL;}}

* /

// ******************************************************** ************ / / / 天 2004-11-5 // QQ: 37878073 (I hope to exchange with everyone)

转载请注明原文地址:https://www.9cbs.com/read-95704.html

New Post(0)