Einzelnen Beitrag anzeigen

Jack and the Juice

Registriert seit: 15. Jan 2011
Ort: Lübeck
52 Beiträge
 
#10

AW: FastReport - Images laden

  Alt 8. Sep 2011, 12:22
Ich melde mich hier nochmals zu Wort, falls jemand anders ein ähnliches Problem haben sollte.

Das hier ist der, von mir zunächst genutzte, falsche Weg:
Delphi-Quellcode:
var
  PictureView: TfrxPictureView;
  imgindex: Integer;
begin
  ...
  if cdsmain.FieldByName('Land').value = 'Deutschlandthen
    imgindex := 0;
  if cdsmain.FieldByName('Land').value = 'Frankreichthen
    imgindex := 1;
  ...
  PictureView := frxReport1.FindObject('landimg') as TfrxPictureView;
  imglist1.GetBitmap(imgindex, PictureView.Picture.bitmap);
end;
Um das Ganze zu realisieren, reichte es bei mir aus, einfach ein TBitmap zu erstellen und dieses dann dem PictureView zuzuordnen. So funktioniert es:
Delphi-Quellcode:
var
  PictureView: TfrxPictureView;
  imgindex: Integer;
  bitmap: TBitmap;
begin
  ...
  if cdsmain.FieldByName('Land').value = 'Deutschlandthen
    imgindex := 0;
  if cdsmain.FieldByName('Land').value = 'Frankreichthen
    imgindex := 1;
  ...
  bitmap := TBitmap.Create;
  try
    imglist1.GetBitmap(imgindex, bitmap);
    PictureView := frxReport1.FindObject('landimg') as TfrxPictureView;
    PictureView.Picture.bitmap := bitmap;
  finally
    bitmap.Free;
  end;
end;
  Mit Zitat antworten Zitat