Autor Beitrag
th3Thr1ll3r
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 31

Win XP Prof
Delphi 6 Pers.
BeitragVerfasst: Sa 01.04.06 11:17 
Hi,

ich möchte im Quelltext (also nicht im Objektinspektor) einem Image-Element ein Bild zuweisen...

Wie mach ich das genau??

MfG

th3Thr1ll3r
Müscha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Sa 01.04.06 11:40 
weiß nicht ob du das meinst aber hier:

ausblenden Quelltext
1:
Image1.Picture.LoadFromFile('C:\Bild.bmp');					



Viele Grüße Müscha
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 01.04.06 11:41 
Das kommt drauf an, wo dein Image sich befindet:

Von der Festplatte laden:
ausblenden Delphi-Quelltext
1:
image1.picture.loadfromfile(dateipfad);					

Ansonsten poste mal, wo sich dein Image befindet.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot


Zuletzt bearbeitet von Marco D. am Sa 01.04.06 12:02, 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 01.04.06 11:51 
@Marco: Vergiss sofort die 2. Variante!!! Die ist FALSCH!!!

Richtig hieße es:

ausblenden Delphi-Quelltext
1:
Image2.Picture.Assign(Image1.Picture);					

_________________
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.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 01.04.06 11:55 
user profile iconBenBE hat folgendes geschrieben:
@Marco: Vergiss sofort die 2. Variante!!! Die ist FALSCH!!!

Schon gemacht :zustimm:
Aber ich kann doch auch z.B. das machen:
ausblenden Delphi-Quelltext
1:
listbox1.items:=list;					

wobei list vom Typ TStringlist ist.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
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 01.04.06 11:58 
Ja, das geht, hat aber einen ganz anderen Effekt ;-)

Wenn man A := B; macht, weist man eine Referenz zu, macht man A.Assign(B); kopiert man den Inhalt ... Das ist insbesondere bei der VCL wichtig, da diese ansonsten vollends streikt (bzw. nette Nebeneffekte hat) ...

_________________
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.
th3Thr1ll3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 31

Win XP Prof
Delphi 6 Pers.
BeitragVerfasst: Sa 01.04.06 12:08 
ok, das ganze sieht jetzt so
ausblenden Delphi-Quelltext
1:
Image01.Picture.LoadFromFile(ExtractFilePath(ParamStr(0))+'/Bilder/karte_hg.bmp');					

aus
und das funktioniert-.-