All pastes #11439 Raw Edit

Someone

public text v1 · immutable
#11439 ·published 2005-05-10 21:14 UTC
rendered paste body
procedure TFormMain.MenuOpenClick(Sender: TObject);
var
   i,j, PhotosPrRow,PhotoNumber: integer;
   Photo: TImage;
   Jpg: TJpegImage;
   Files: TStrings;
begin
   if OpenPictureDialog.Execute then
   begin
      Files:=OpenPictureDialog.Files;
      PhotoList:=OpenPictureDialog.Files;
      PhotoCount:=PhotoList.Count;
      PhotosPrRow:=(FormMain.Width - MinPhotoSpace) div (MiniPhotoWidth + MinPhotoSpace);
      PhotoSpace:=(FormMain.Width - PhotosPrRow * MiniPhotoWidth) div (PhotosPrRow+1)-1;
      for i:=0 to (Ceil(PhotoCount / PhotosPrRow) - 1) do
      begin
         for j:=0 to (PhotosPrRow - 1) do
         begin
            PhotoNumber:=i*PhotosPrRow+j;
            Photo:=TImage.Create(FormMain);
            Photo.Parent:=FormMain;
            Photo.Tag:=PhotoNumber;
            Photo.Top:=PhotoSpace+i*(PhotoSpace+MiniPhotoHeight);
            Photo.Left:=PhotoSpace+j*(PhotoSpace+MiniPhotoWidth);
            Photo.Width:=MiniPhotoWidth;
            Photo.Height:=MiniPhotoHeight;

            Jpg:=TJpegImage.Create;
            Jpg.LoadFromFile(Files[PhotoNumber]);
            Photo.Picture.Bitmap.Assign(Jpg);
            Jpg.Free;

            Photo.Center:=true;
            Photo.Stretch:=true;
            Photo.Proportional:=true;

            Photo.OnClick:=FlipBitmapRight;

            if PhotoCount-1=PhotoNumber then break;
         end;
      end;
   end;

end;