How to implement picture zoom in C #

xiaoxiao2021-03-06  42

// ******************************************************** *********** //// 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 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;}} /// /// proportion Reproduction the picture, automatically calculate the height /// /// source diagram file name (including path) /// Save after zooming To file names (including path) ////

StrolDPIC "> Source Map file name (including path) /// saved as file name (including path) /// reduced to a height 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;}}

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

New Post(0)