So I’m new to Delphi and I have a button and when it is clicked it opens an OpenPictureDialog. I then want to create a popup box with that picture loaded into it. I’m not sure what the best approach to this would be?
I was thinking to make a new form on the button click event and then put the image into that, but I can’t figure out how to pass a TImage to a form constructor.
OpenPictureDialog1.Execute;
img.Picture.LoadFromFile(OpenPictureDialog1.FileName);
TForm2.Create(Application, img).Show;
Does anyone have a better idea of how to do this or a way to fix what I’m trying to do?
Thanks.
You better put the TImage component in your secondary form and pass a filename, for example, create a new constructor for your form like this:
Then, you can create and show your form like this:
Edit
If you want to create the image at runtime, you can do it like this: