O.K.
El formulario tiene un boton que envia a un procedimiento con parámetros:
Código:
procedure TfrmPpal.tabular2(Ini,Fin,Sal: integer);
var
encuesta,i,j,k,l,m,t,PuntoMatrizVer,IncrementoVer,verificador,Deltay:integer;
nombre:string;
Hoja,bmp:TBitmap;
verificacion:array[0..55] of Tcolor;
cuadro1,cuadro2:TRect;
tercio1,tercio2:TMemoryStream;
myibBlob: TStream;
gif:TGIFImage;
begin
encuesta:=HojaIni;
for j:=hojaini to hojafin do
begin
hoja:=Tbitmap.Create;
Cuadro1.Left:=16;
Cuadro1.Top:=21;
Cuadro1.Right:=826;
Cuadro1.Bottom:=368;
Cuadro2.Left:=16;
Cuadro2.Top:=21;
Cuadro2.Right:=826;
Cuadro2.Bottom:=368;
Deltay:=0;
if j<10 then
nombre:='Explorar000'+IntToStr(j)+'.bmp'
else if (j>9) and (j<100) then
nombre:='Explorar00'+IntToStr(j)+'.bmp'
else if (j>99) and (j<999) then
nombre:='Explorar0'+IntToStr(j)+'.bmp';
hoja.LoadFromFile(ruta+nombre);
for i:=1 to 3 do
begin
g1.Progress:=encuesta;
if frac(encuesta/sal)=0 then
if prgbarTabulacion.Position<prgbarTabulacion.Max then
prgbarTabulacion.StepIt;
gif:=TGIFImage.Create;
bmp:=Tbitmap.Create;
bmp.Height:=347;
bmp.Width:=810;
gif.Height:=347;
gif.Width:=810;
ibtblEncuesta.Active:=true;
ibtblEncuesta.Insert;
myibBlob:=ibtblEncuesta.CreateBlobStream(ibtblEncuestaBMPS,bmWrite);
tercio1:=TMemoryStream.Create;
tercio2:=TMemoryStream.Create;
ibtblEncuestaIDENCUESTA.Value:=encuesta;
for k:=0 to 57 do
begin
IncrementoVer:=0;
verificador:=0;
PuntoMatrizVer:=0;
for l:=px1[k] to px2[k] do
begin
for m:=py1[k] to py2[k] do
begin
verificacion[PuntoMatrizVer]:=hoja.Canvas.Pixels[l,m+deltay];
if verificacion[PuntoMatrizVer]=clwhite then
IncrementoVer:=1
else
IncrementoVer:=0;
verificador:=verificador+IncrementoVer;
end;
end;
if verificador=0 then
ibtblEncuesta.Fields[k+1].value:=1
else
ibtblEncuesta.Fields[k+1].value:=0;
end;
bmp.Canvas.CopyRect(bmp.Canvas.ClipRect,hoja.Canvas,cuadro1);
bmp.SaveToStream(tercio1);
gif.Assign(bmp);
gif.SaveToStream(tercio2);
myibBlob.CopyFrom(tercio2,0);
tercio1.Free;
myibblob.Free;
tercio2.Free;
gif.Free;
Cuadro1.Left:=16;
Cuadro1.Top:=cuadro1.Bottom;
Cuadro1.Right:=826;
Cuadro1.Bottom:=cuadro1.Bottom+347;
encuesta:=encuesta+1;
deltay:=deltay+348;
ibtblEncuesta.Post;
ibtscPpal.Commit;
end; // fin rutina de tabulacion de 3 encuestas por hoja
hoja.Free;
end; // fin rutina de tabulacion de hojas
pnlOcultar.SendToBack;
ibtblEncuesta.Active:=true;
ibtblEncuesta.Refresh;
ibtblEncuesta.Last;
ibtblEncuesta.First;
end;
Bueno los parámetros son
HojaIni: inicio de las hojas escaneadas y guardadas como archivo con el nombre "Explorar0001.bmp"
HojaFin: Fin de las hojas escaneadas y guardadas como archivo con el nombre "Explorar0689.bmp"
Cada archivo es una hoja de encuesta con tres encuestas cada una. este archivo es de 850x1100 pixeles. El procedimiento, mediante el Trect Cuadro1 y cuadro2 se desplaza en la lectura de las encuestas.
En el uses esta gifimage que es la de TGIFImage de Andrew Malander.
Sergio