timage - How to insert picture in the Delphi program itself? -
i have used timage
component in program.
at runtime, add image component using:
image1.picture.loadfromfile('c:\users\53941\pictures\eq1.jpg');
now, want run program on other computer, not have image file @ source have given in code.
so, how can store image file in program executable itself?
store image file in program's resources, using .rc
script or ide's resources , images
dialog. read embarcadero's documentation more details:
you can use tresourcestream
access resource data @ runtime. construct tjpegimage
object, load stream it, , assign timage
:
uses ..., classes, jpeg; var strm: tresourcestream; jpg: tjpegimage; begin strm := tresourcestream.create(hinstance, '<resource identifier>', rt_rcdata); try jpg := tjpegimage.create; try jpg.loadfromstream(strm); image1.picture.assign(jpg); jpg.free; end; strm.free; end; end;
Comments
Post a Comment