I did it now the same way that I did in 2016:
procedure TImageEnMViewHelper.PrintAllOrCheckedPages;
var
TempView: TImageEnMView;
I, PaginaAtual: Integer;
ieBmp: TIEBitmap;
begin
if Self.ImageCount = 0 then begin
ShowAlerta('Nenhuma imagem sendo exibida para ser impressa!');
Exit;
end;
if Self.CheckedCount = 0 then
Self.MIO.DoPrintPreviewDialog('Imprimir', True, 'Visualizar Impressão', False)
else begin
PaginaAtual := Self.SelectedImage;
ieBmp := TIEBitmap.Create;
TempView := TImageEnMView.Create(nil);
TempView.MIO.PrintPreviewParams.DlgMaximized := True;
TempView.MIO.PrintPreviewParams.MarginTop := 0;
TempView.MIO.PrintPreviewParams.MarginLeft := 0;
TempView.MIO.PrintPreviewParams.MarginRight := 0;
TempView.MIO.PrintPreviewParams.MarginBottom := 0;
TempView.AnnotationsVisible := True;
Self.LockUpdate;
try
for I := 0 to Self.ImageCount - 1 do begin
Self.SelectedImage := I;
if Self.Checked[i] then begin
ieBmp.AssignImage(Self.IEBitmap);
TempView.InsertImage(TempView.ImageCount,ieBmp);
end;
end;
TempView.SelectedImage := 0;
TempView.MIO.DoPrintPreviewDialog('Imprimir', True, 'Visualizar Impressão', False);
finally
ieBmp.Free;
TempView.Free;
Self.SelectedImage := PaginaAtual;
Self.UnlockUpdate;
end;
end;
end;
When you can, please let me know if there's a better way to do that!
Also, I'll work mainly with the checkbox for selection, so DeleteSelectedImages will not work too, I'll have to create a helper SelectCheckedPages I guess, would be nice to have a way to use the checks or the selection itself.
Thanks!