How to implement picture zoom in C #

xiaoxiao2021-03-06  37

// ******************************************************** *********** //

// The following three simple methods are given, and the following two methods are expanded, and it is estimated that

// ******************************************************** *********** //

///

/// narrow the picture

///

/// Source diagram file name (including path)

/// Save as file name after zooming out (including path)

/// zoom to the width

/// shrink to height

Public void SmallPic (String StrildPic, String StrnewPic, Int IntWidth, Int Height)

{

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;

}

}

///

/// Recruit the picture, automatically calculate the height

///

/// Source diagram file name (including path)

/// Save as file name after zooming out (including path)

/// zoom to the width

Public void SmallPic (String StrildPic, 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;

}

}

///

// / Reproduction the picture to automatically calculate the width

///

/// Source diagram file name (including path) /// saved 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 = (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-72463.html

New Post(0)