Autor Beitrag
Tony-S
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Sa 26.06.10 21:49 
Hallo Forum ich weiße einem Bitmap-Array verschiedene Bildschirminhalte zu und möchte über einen Klick auf eine ListBox mir die unterschiedlichen Ausschnitte anzeigen:

ausblenden Delphi-Quelltext
1:
var frames: array [0..10000of tbitmap;					


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
procedure TfrmCounter.Timer2Timer(Sender: TObject);
var i: integer;
begin
            begin
            frames[counter] := tbitmap.create;

            frmIMG.ListBox1.Items.Add(IntToStr(counter));
            //in der Form frmIMG möchte ich dann auf die Ausschnitte zugreifen
   
                  try
                  ScreenShot(DesktopBitmap);
                  finally
                  DesktopBitmap.FreeImage;

                  lBitmap.canvas.draw(-min(X1,y1),-min(x2,y2),desktopbitmap);
                  frames[counter].assign (lBitmap);
                  inc (counter);
                  end;
            if counter = 10 then
            begin
            timer2.enabled := false;
            counter := 0;
            frmIMG.Show;
          
            end;
end;
end;


wenn ich dann auf frmIMG folgendes versuche:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TfrmIMG.ListBox1Click(Sender: TObject);
var
i: Integer;
begin
  for i:=0 to high(frames)-1 do image1.picture.bitmap.assign (frames[i]);
end;


bekomm ich garnichts angezeigt, das Bild bleibt leer,

wenn ich mir direkt eins raussuche ungefähr so:

ausblenden Delphi-Quelltext
1:
frmIMG.image1.picture.bitmap.assign(frames[5]);					


klappt das aber. Was mach ich denn falsch? Muss ich das anders als über eine Schleife lösen?
Vielen Dank schon mal für eure Tips :).
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 26.06.10 22:37 
Ich sehe ohnehin keinen Sinn darin in der Schleife nacheinander die Bilder zuzuweisen ohne diese überhaupt anzuzeigen. :nixweiss:

Denn solange deine Schleife läuft passiert ja nix anderes in deinem Programm, auch kein Zeichnen.
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Sa 26.06.10 22:39 
Sorry aber, ich hab überhaupt keine Ahnung, was du mir damit sagen möchtest.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Sa 26.06.10 22:52 
Das durch die schleife das bild nie gezeichnet wird, weil das Programm dazu keine Zeit hat. ;)

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Sa 26.06.10 22:58 
Ah achso okay, macht Sinn :D naja dann wohl so:

ausblenden Delphi-Quelltext
1:
Image1.Picture.Bitmap.Assign(frames[ListBox1.itemindex]);					
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Sa 26.06.10 23:03 
Solange du es in der Schleife ausführst wird es nix ändern welche Integer-Variable du verwendest.

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 26.06.10 23:03 
Und ganz wichtig ist noch zu prüfen ob der ItemIndex auch einen gültigen Wert hat. ;-)
ausblenden Delphi-Quelltext
1:
2:
if ListBox1.ItemIndex >= 0 then
  ...
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Sa 26.06.10 23:14 
Jo.. danke :D, manchmal hab ich wohl n Brett vorm Kopf ;)