procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
Image1.Picture.Bitmap.LoadFromFile(OpenPictureDialog1.FileName);
end;
Better do it like this:
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
so as to be able to load any supported format. It's also more Delphi-compatible, IIRC.
Incidentally, in HowardPC's mini-code:
- procedure TForm1.Button1Click(); is the handler of a TButton (Button1) OnClick event;
- OpenPictureDialog1 is a TOpenPictureDialog
- Image1 is a TImage
We are suppossing that you're using Lazarus and that you know how to place components on the form, change properties, add event handlers, etc. If this is not the case, please tell us and we will adjust the "level" of our responses.