Hallo,
Ich bin neu hier, und habe auch schon eine Frage wegen eines Problems, bei dem ich einfach nicht weiterkomme!
Ich habe gestern folgende Delphi procedure erstellt um Schnell und Einfach Bilder Dynamisch zur Laufzeit einzufügen!
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: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44:
| procedure image_simple_load(str: string); var img: Timage; i: integer; result, value, wert: string; begin if not (Copy(Trim(str), length(str)) = ';') then begin str := str + ';'; end; img := TImage.Create(nil); img.Parent := Form1; for i := 2 to count_chars(str, ';')+1 do begin result := Trim(split(str,';',i)); result := result + ':'; value := split(result,':',2); wert := split(result,':',3);
if value = 'name' then begin img.Name := wert; end else if value = 'path' then begin img.Picture.loadfromfile(wert); end else if value = 'width' then begin img.Width := StrToInt(wert); end else if value = 'height' then begin img.Height := StrToInt(wert); end else if value = 'visible' then begin img.Visible := StrToBool(wert); end else if value = 'left' then begin img.Left := StrToInt(wert); end else if value = 'top' then begin img.Top := StrToInt(wert); end else if value = 'stretch' then begin img.Stretch := StrToBool(wert); end;
end; end; |
EINFÜGREN!!!!
Delphi-Quelltext
1:
| image_simple_load('left:100; top:50; width:400; height:400; visible:true; name:bild1; path:t.bmp; stretch:false'); |
Jetzt benötige ich eine 2te funktion bei der überprüft werden soll, ob das Bild Name: "bild1" existiert! wie mache ich das???
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9:
| function image_is_loaded(str: string): Boolean; begin if BILD NAME bild1 EXISTIERT then begin LIEFTERT true end else begin LIEFERT false end; end; |
Währe dankbar über eine Antwort
Moderiert von
Narses: Topic aus Multimedia / Grafik verschoben am So 29.08.2010 um 12:57