Esvazeamento de Pilha com QReport por causa da foto

11/03/2006

0

Olá pessoal,

estou fazendo um relatório de alunos, aonde aparecem fotos. o caminho para as fotos está guardado no banco (interbase). Esou usando um qrimage, coloquei um data source e no evento on data change coloquei a procedure MostrarImagem(Image: TQRImage; Caminho: String);
o código dela é esse:

procedure TFormRelUsuariosGeral.MostrarImagem(Image: TQRImage; Caminho: String);
begin
if Caminho = ´´ then
begin
Image.Picture.Assign(nil);
end
else
try
Image.Picture.LoadFromFile(Caminho);
except
Image.Picture.Assign(nil);
end;
end;

por que ocorre este erro???? qdo eu não coloco foto aparece tudo normal. com foto as vezes ele abre p três usuários (com foto ou sem) e no 3 dá erro.

alguém pode me ajudar???

desde já grato,

Emanuel


E-fcosta

E-fcosta

Responder

Posts

12/03/2006

Aroldo Zanela

Colega,

Utilize o link acima ´pesquisar´ e entre com o argumento EDBImage. Você vai encontrar informações sobre esse componente que tem um descendente específico para o QR, e veja se o problema é resolvido. Teste numa outra máquina com mais memória o programa atual para ver se resolve também.


Responder

12/03/2006

E-fcosta

Olá Aroldo,

acho q não é memória não, pq estou num pentium 2.4ghz e 512ram. vou dar uma olhada.

Obrigado.

Emanuel


Responder

12/03/2006

Aroldo Zanela

Colega,

Na base de conhecimento da QUSOFT (Fabricante do QR), encontrei FAQs relacionadas:

[quote:e518e67f22=´KB da QUSoft´]
[Images and Shapes]
==================
Q. My images do not print consistently.
A. This can happen for a few reasons. If you are using a TQRDBImage and the images do not always print, it may be a problem with how the BDE is handling the BLOB data.
Instead of using a TQRDBImage, use a TQRImage and a TDBImage. Assign the database bitmap to the TDBImage (you will need to add a TDataSource to assign the field to the TDBImage). In the BeforePrint event of the band that contains the TQRImage, assign the TDBImage´s bitmap to the TQRImage´s bitmap.
Example:
procedure TfrmImageTest.DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
qrimage1.picture.bitmap.assign(DBImage1.Picture.Bitmap);
end;

If you are using a TQRImage and loading the image directly into the component does not work, try loading the image into a TBitmap and then copying the data to the TQRImage component.
Example 1:
MyBitmap.LoadFromFile(somefile); // MyBitmap is a TBitmap that is created and freed somewhere else
QRImage.Picture.Bitmap.Assign(MyBitmap);
Example 2:
MyBitmap.LoadFromFile(somefile);
QRImage.Picture.Bitmap.Height := MyBitmap.Height;
QRImage.Picture.Bitmap.Width := MyBitmap.Width;
QRImage.Picture.Bitmap.Canvas.Draw(0,0, MyBitmap);
------------------
[/quote:e518e67f22]


Responder

22/03/2006

E-fcosta

Aroldo muito obrigado pela ajuda. a sua dica foi fundamental. ta funcionando blz. o meu código ficou assim(eu coloco um datasource e dentro delo coloco o procedimento abaixo ):

var
Bitmap : TBitmap;
begin
Bitmap := TBitmap.Create;
Bitmap.Height:= 100;
Bitmap.Width:= 50;
try
if (ibqueryTitulos.FieldByName(´FOTO´).IsNull) or
(ibqueryTitulos.FieldByName(´FOTO´).AsString = ´´) then
begin
Bitmap.Assign(nil);
QRImageFoto.Picture.Assign(nil);

end
else
begin
Bitmap.LoadFromFile(ibqueryTitulos.FieldByName(´FOTO´).AsString);
QRImageFoto.Picture.Bitmap.Height := Bitmap.Height;
QRImageFoto.Picture.Bitmap.Width := Bitmap.Width;
QRImageFoto.Picture.Bitmap.Canvas.Draw(0,0, Bitmap);



end;
finally

Bitmap.Free;
end;
end;

Tem um colega lá no active delphi q tava com o mesmo problema vou passar a sua solução para ele.

Obrigado

Emanuel.


Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar