Hiho...
Also ich verzweifel langsam... Eine typische Aufgabe für die Schule: Einen eigenen mspaint-Klon...
Jetzt wollte ich gerade eine tolle Undo/Redo-Funktion einbauen:
Es existiert ein Array von TBitmap mit 10 Spalten. Immer wenn man bild etwas geändert wird, besetzt dieses eine neue Spalte im TBitmap-Array. Wenn die 10. Spalte voll ist, wird alles um eine Stelle nach links geschoben: 1 wird zu 2, 2 zu 3, ... 8 zu 9, 9 zu 10 und 10 wird das neue Bild.
Das Problem ist folgendes: Sobald ich in das TBitmap-Array BMP[10] mir das aktuelle Bild aus der Paintbox hole (mit Canvas.CopyRect) wird das nicht nur in BMP[10], sondern auch in BMP[9] gespeichert:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
| for i:=1 to 9 do BMP[i]:=BMP[i+1];
BMP[9].SaveToFile('d:\neues_9.bmp'); BMP[10].SaveToFile('d:\neues10.bmp');
BMP[10].Canvas.CopyRect( Rect(0,0,BMP[10].Width,BMP[10].Height), MainForm.PaintBox.Canvas, Rect(0,0,BMP[10].Width,BMP[10].Height));
BMP[9].SaveToFile('d:\ganzneues_9.bmp'); BMP[10].SaveToFile('d:\ganzneues10.bmp'); |
das bild d:\ganzneues_9.bmp ist ein anderes als d:\neues_9.bmp... und das ist doch wohl unmöglich!!
wie kann das sein`? irgendeine idee?
vielen dank im vorraus,
mfg,
jens
==edit==
joa, ich bin halt dumm...
meine notlösung ist bis hier jemand antwortet halt BMP[x].assign()
