Autor Beitrag
Jungsta
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 17:49 
Hallo erst einmal.
Ich habe ein Programm geschrieben(siehe anhang),
in dem man beliebig viele Bitmaps in einen Stream
speichern kann.
Nun möchte ich diese öffnen.
Eins klappt, aber wenn ich dann das zweite öffnen will:
Stream.Position := Stream.Position + 1;
Bitmap.LoadFromStream(Stream);
kommt eine Fehlermeldung :?:
Weiß vielleicht einer warum???
Und wie kann ich den Code in so eine Box einfügen?
Einloggen, um Attachments anzusehen!
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Sa 05.05.07 17:57 
Position ist die Größe in Bytes und nicht in Bildern. Die Position muss also auf die Größe des 1. Bildes gesetzt werden.

Nach dem laden des 1. Bildes sollte die Position aber eigentlich schon richtig gesetzt sein.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 18:10 
OK, danke, ich werde es ausprobieren :zustimm:
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 18:18 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var
stream: TFileStream;
Bitmap: TBitmap;
begin
Bitmap := TBitmap.Create;
Stream := TFileStream.Create('C:\Dokumente und Einstellungen\Tim\Desktop\Movie Maker\Bild.vot', fmOpenRead or fmSharedenyRead);
Bitmap.LoadFromStream(Stream);
Image1.Picture.Bitmap:= Bitmap;
Stream.Position:= 5318;
end;

Das funzt irgendwie auch nicht, habe ich etwas übersehen?

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Sa 05.05.07 18:22 
Is das der Code zum laden vom ersten oder 2. Bild?

Eigentlich sollte das so klappen:
ausblenden Delphi-Quelltext
1:
2:
bild1.LoadFromStream(stream);
bild2.LoadFromStream(stream);

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 18:25 
Ich hatte eigenlich gedacht, dass wenn ich auf den Button klick, dass dann das zweite Bild erscheint. Gibt es auch eine Methode, die automatisch das nächste Bild anzeigt??? :)
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: So 06.05.07 09:23 
Also wenn ich die Bilder mit einzelnen Buttons öffne, funktioniert es:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var
Stream: TStream;
Bitmap: TBitmap;
begin
Stream:= TFilestream.Create('C:\Dokumente und Einstellungen\Tim\Desktop\Movie Maker\Bild.vot', fmOpenRead or fmSharedenyRead);
Stream.Position:= 5318;
Bitmap:= TBitmap.Create();
Bitmap.LoadFromStream(Stream);
Image1.Picture.Bitmap:= Bitmap;
Stream.Free;

Aber wenn ich alles in einem Button mach und eine Variable 'i' habe und diese immer um 5318
aufzähle kommt eine Fehlermeldung: Stream-Lesefehler!!!
Warum geht es so nicht???
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: So 06.05.07 18:41 
Ich habe es jetzt selbst herausgefunden!!! :lol: :D
Und danke für alle Antworten!!