* * >>> THIS PROC WORKS PROCEDURE lGetNewImage * * Get a new picture Image With Thisform * mImage = getpict() * * Draw the image into GdiPlusX * ----------------------------- local loBmp as xfcBitmap local loGfx as xfcGraphics loGfx = Thisform.imgEdit.oGfx * Clear the image .imgEdit.Clear(rgb(255,255,255)) loBmp = _Screen.System.Drawing.Bitmap.FromFile(mImage) * * >>> SAVE loBmp * Save pointer so we can use it for other things .oSrcImage = loBmp * * Now let's draw in the Canvas loGfx.DrawImage(loBmp,0,0, .OrgImageWidth, .OrgImageHeight) * Draw image to the image container. .imgEdit.Draw() EndWith * * ------------------ * * >>> THIS PROC WORKS BUT THE RESIZED IMAGE DOES NOT SHOW ON THE FORM. PROCEDURE lResizeImage * lParameters lnWidth, lnHeight * * Resize the current image. WITH _SCREEN.System.Drawing * * Load the original Image * LOCAL loSrcImage as xfcBitmap * loSrcImage = .Bitmap.New(GETPICT()) * >>> GET THE OBJECT SAVED WHEN WE GOT THE FILE LOCAL loSrcImage as xfcBitmap loSrcImage = Thisform.oSrcImage && Saved when we loaded the file * Create a New Image with the desired size LOCAL loResized as xfcBitmap loResized = .Bitmap.New(lnWidth, lnHeight, ; .Imaging.PixelFormat.Format32bppARGB) * Set the image resolution to be the same as the original loResized.SetResolution(loSrcImage.HorizontalResolution, ; loSrcImage.VerticalResolution) * Obtain a Graphics object to get the rights to draw on it LOCAL loGfx as xfcGraphics loGfx = .Graphics.FromImage(loResized) * Set some properties, to ensure to have a better quality of image loGfx.SmoothingMode = .Drawing2D.SmoothingMode.HighQuality loGfx.InterpolationMode = .Drawing2D.InterpolationMode.HighQualityBicubic * Draw the source image on the new image at the desired dimensions loGfx.DrawImage(loSrcImage, 0, 0, lnWIdth, lnHeight) * >>> THIS WORKS * Save the resized image as Png loResized.Save("c:\Resized3.png", .Imaging.ImageFormat.Png) * >>> THIS DOES NOT WORK Thisform.imgEdit.Draw() Thisform.Refresh() ENDWITH