It is known that the image formats supported by GDI + are BMP, JPEG, GIF, Tiff, PNG, ICO, WMF, and EMF.
The tgpgraphics. drawimage function has too many reloads. Column them together:
Function drawimage (image: tgpimage; const point: tgppointf): tstatus; overload; function drawimage (image: tgpimage; X, Y: single): tstatus; overload; function drawimage (image: tgpimage; const rect: tgprectf): tstatus; overload; function drawimage (image: tgpimage; x, y, width, height: single): tstatus; overload; function drawimage (image: tgpimage; const point: tgppoint): tstatus; overload; function drawimage (image: tgpimage; X, Y: integer): tstatus; overload; function drawimage (image: tgpimage; const rect: tgprect): tstatus; overload; function drawimage (image: tgpimage; x, y, width, height: integer): tstatus; overload; function drawimage (image: tgpimage; destpoints: pgppointf; count: integer): tstatus; overload; function drawimage (image: tgpimage; destpoints: pgppoint; count: integer): tstatus; overload; function drawimage (image: tgpimage; x, y, srcx, srcy, srcwidth, srcheight: single; srcunit: tunit): tstatus; overload; function drawimage (image: tgpimage; const destrect: tgprectf; srcx, srcy, srcwidth, srcheight: single; srcunit: tunit; imageattributes: bytes = nil; callback: drawimageabort = nil; callbackdata: pointer = nil): tstatus; overload; function drawimage (image: tgpimage; destpoints: pgppointf; count: integer; srcx, srcy, srcwidth, srcheight: single; srcunit: tunit; imageattributes: tgpimageattributes = nil; callback: drawimageabort = nil; callbackdata: pointer = nil): tstatus; overload; function drawimage (image: tgpimage; x, y, srcx, srcy, srcwidth, srcheight: integer; srcunit: tunit): tstatus; overload; function drawimage (image: tgpimage; const destrect: tgprect; srcx, srcy, srcwidth, srcheight: integer; srcunit: tunit; imageattributes: bytes = nil; callback: drawimageabort = nil; callbackdata: pointer = nil): tstatus; overload; function drawimage (image: tgpimage; destpoints: pgppoint; count, srcx, srcy, srcwidth, srcheight: integer; srcunit: tunit; imageattributes: tgpimageattributes = nil; callback: drawimageabort = nil; callbackdata: pointer = nil): tstatus; overload;
In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs; Type tform1 = Class (tform) Procedure formpaint (Sender: tobject); end; vaR form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; Procedure tform1.formpaint (Sender: tobject); var G: tgpgraphics; IMG: tgpimage; begin G: = tgpgraphics. create (self. canvas. handle); IMG: = tgpimage. create ('C: \ temp \ test.jpg '); G. drawimage (IMG, 0, 0, IMG. getwidth, IMG. getheight); IMG. free; G. free; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 290 clientwidth = 355 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false onpaint = formpaint pixelsperinch = 96 textheight = 13end