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 09:50 
Ich habe das Problem, dass ich Bilder durch
Image1.Picture.Graphic.SaveToStream(Stream);
in einen Stream Speichere und möchte diese nacheinander
wieder in einem image anzeigen.
Schon mal danke für die antworten.
:D


Zuletzt bearbeitet von Jungsta am Sa 05.05.07 14:09, insgesamt 1-mal bearbeitet
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 05.05.07 10:00 
LoadFromStream :wink:

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 10:19 
OK danke jetzt würde ich noch gerne wissen wie man etwas von einer bestimmten Stelle des Streams lädt.
Aber wenn ich
Image2.Picture.Graphic.LoadFromSTream(Stream);
benutze dann kommt eine Fehlermeldung mit einer
Zugriffsverletzung. :?:


Zuletzt bearbeitet von Jungsta am Sa 05.05.07 10:28, insgesamt 1-mal bearbeitet
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 05.05.07 10:25 
LoadFromStream läd ab der aktuellen Position im Stream.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 10:29 
user profile iconBenBE hat folgendes geschrieben:
LoadFromStream läd ab der aktuellen Position im Stream.


Wie kann ich denn dann An den Anfang kommen?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 05.05.07 10:30 
Siehe Delphi-Hilfe TStream. Die Eigenschaft dafür ist trivial undintuitiv zu finden.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 10:37 
Ich habe jetzt in der Hilfe die Methode
Stream.Position := 0; //Der stream wird auf die Posiition 0 gesetzt
Aber das mit dem LoadFromStream funzt immer noch nicht:
Image2.Picture.Graphic.LoadFromStream(Stream);
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 05.05.07 10:43 
Wenn kein Picture in einem Image geladen ist, so zeigt Graphic immer auf ein Bitmap. Und in deinem Stream wird sicherlich alles andere als ein Bitmap stehen??? Image1.Picture.LoadFromStream.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 10:47 
user profile iconBenBE hat folgendes geschrieben:
Wenn kein Picture in einem Image geladen ist, so zeigt Graphic immer auf ein Bitmap. Und in deinem Stream wird sicherlich alles andere als ein Bitmap stehen??? Image1.Picture.LoadFromStream.

Image1.Picture.LoadFromStream funzt auch nicht da kommt Undefinierter Bezeichner
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 11:19 
Also ich speichere und öffne meine Streams jetzt so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject);
var
Bitmap: TBitmap;
Bitmap2: TBitmap;
Stream: TFileStream;
begin
Bitmap := TBitmap.Create;
Bitmap2 := TBitmap.Create;
Bitmap.LoadFromFile('.\Bild1.bmp');
Stream:= TFileStream.Create('.\Stream.Datei', fmCreate);
Bitmap.SaveToStream(Stream);
Bitmap2.LoadFromStream(Stream);
Image1.Picture.Bitmap := Bitmap2;
end;


Das funktioniert auch ganz gut, aber ich würde auch gerne von einem anderem Programm darauf zugreifen können!!!

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt


Zuletzt bearbeitet von Jungsta am Sa 05.05.07 13:57, insgesamt 1-mal bearbeitet
Jungsta Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Win Xp
Delphi 7 Pers.
BeitragVerfasst: Sa 05.05.07 13:55 
Ich habe es geschafft, dass ich die Bitmaps speichere :) :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Button3Click(Sender: TObject);
var
fs: TFileStream;
Bitmap: TBitmap;
i, c: Integer;
begin
i:= 0;
c:= 0;
SaveDialog1.Execute;
FS := TFileStream.Create(saveDialog1.FileName + '.vot', fmCreate);
Bitmap := TBitmap.Create;
for i := 0 to (ListBox1.Count - 1do
begin
Bitmap.LoadFromFile(Listbox1.Items[i]);
Bitmap.SaveToStream(FS);
inc(c);
end;
end;

Aber wenn ich dann eins öffne und dann die Position im Stream zu ändern, dann kommt eine Fehlermeldung und das Programm stürzt ab!!! :cry: :?:

Moderiert von user profile iconraziel: Highlight- durch Delphi-Tags ersetzt