1, read the picture
Static container Sml_imgurl2bitmap (str imgurl,str newfilename = ' axTmpImgName1111 ') {System.Net.HttpWebRequest HttpR Equest = null; System.Net.HttpWebResponse HttpResponse = null; Clrobject CLRO = null; System.IO.Stream Stream; System.IO.StreamReader reader; System.Drawing.Image Webimage; Bindata biddata=new bindata (); Bitmap Bitmap; STR Savefilepath; STR filepath, filename, fileext; Real Height,width; ; [filepath, filename, fileext] = Filenamesplit (Imgurl); Filepath= Winapi::gettemppath (); Filename= NewFileName; New Interoppermission (Interopkind::clrinterop). assert (); try {clro = system.net.webrequest::create (Imgurl); HttpRequest = CLRO; HttpResponse = Httprequest.getresponse (); stream = Httpresponse.getresponsestream (); reader = new System.IO.StreamReader (Stream); Webimage = System.drawing.image::fromstream (stream); Savefilepath = Filepath+newfilename+fileext; Webimage.save (Savefilepath); Biddata.loadfile (Savefilepath); Bitmap = Biddata.getdata (); Height = webimage.get_height (); width = Webimage.get_width ();
} catch (Exception::clrerror) {return [bitmap,0,0]; } return [Bitmap,height,width];}
2, proportional display of pictures, A4 paper, Portrait printing
voidinitprodimg () {inventparameters inventparameters;
STR Imgurl; #define. Picmaxwidth (18)//Allow maximum width of picture#define. Picmaxheight (8)//allow maximum height of pictureContainer Scalesize (intCURRW,intcurrh) {Real Maxw= #PicMaxWidth, maxh=#PicMaxHeight; Real ratio= Currh/CURRW; if(currh<=144) Maxh=3; Else if(currh<=192) Maxh=4; Else if(currh<= -) Maxh=5; Else if(currh<=288) Maxh=6; if(CURRW >=Maxw) {CURRW=Maxw; Currh= CURRW *ratio; } if(Currh >=maxh) {Currh=Maxh; CURRW= Currh/ratio; } return[CURRW, Currh]; } voidReseth (intcurrh) {ctritemimg.height (CURRH,UNITS::CM); } voidRESETW (intCURRW) {ctritemimg.width (CURRW,UNITS::CM); } ; InventParameters=Inventparameters::find (); Imgurl= Inventparameters.sml_inventimgurl +Curprodtable.sml_inventtableext (). Sml_inventimgurl; Try{[Prodimg,imgheight,imgwidth]=Sml_imgurl2bitmap (Imgurl); if(!imgheight | |!imgwidth) {Reseth (0); return; } Else{[Imgwidth,imgheight]=scalesize (imgwidth,imgheight); Reseth (ImgHeight); RESETW (ImgWidth); Ctritemimg.resizebitmap (true)//allows the picture to be scaled by the size of the control. } } Catch(Exception::clrerror) {}}
Report Print network proportionally print network pictures