Autor Beitrag
´|` R /\ I | ) O $
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 62



BeitragVerfasst: Do 10.04.08 16:27 
Hi, ne kurze Frage: Wie kann ich dauerhaft n Bild anzeigen lassen, ohne es beim Start es Programs extra aussuchen zu müssen, also im Prinzip wie n Banner bei nem MMORPG? THX
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 10.04.08 16:35 
Komponente: TImage, Eigenschaft: Picture.

_________________
We are, we were and will not be.
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Do 10.04.08 16:37 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
myBitmap := TBitmap.Create;
myBitmap.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'Bilder\MeinBild.bmp');
Image1.Canvas.draw(0, 0, myBitmap);
myBitmap.Free;


ExtractFilePath(ParamStr(0)) liefert den Pfad der laufenden Exe. 'Bilder' ist ein Unterordner, damit die .exe nicht so unüberwsichtlich im Bilderordner herumliegt.

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
bflegel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP, Win 7, BS2000
D5
BeitragVerfasst: Do 10.04.08 16:39 
Bei TImage entweder im OI unter Picture (wie von Gausi geschrieben) oder per Code im OnCreate des Forms:

ausblenden Delphi-Quelltext
1:
  Image1.Picture.Bitmap.LoadFromFile('c:\bitmap2.bmp');					


bye
bflegel

// Hmmm zu spät. Kommt davon wenn man alles erst ausprobiert :D

_________________
I know all the jokes about my name
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Do 10.04.08 16:49 
Hi,

Die von bFlegel und Gausi angesprochene Methode funktioniert und du kannst das auch ersteinmal so realisieren(direkt im Picture.LoadFromFile).

Allerdings solltest du immer nur ein Image verwenden; andere Bilder, als TBitmaps im Code dynamisch erzeugt, zeichnest du dann mit Canvas.Draw(), bzw. mit Canvas.StretchDraw(), auf das eine Image.

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
´|` R /\ I | ) O $ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 62



BeitragVerfasst: Fr 11.04.08 14:59 
ausblenden Delphi-Quelltext
1:
Image1.Picture.Bitmap.LoadFromFile('C:\Dokumente und Einstellungen\XXX\Desktop\Projekt^^');					

Das is der Quelltext und ich hab in der Maske auch n Image1 Ding ( hab das von Zusätzlich/Image ) drinne^^
Er bricht aber immer ab, also es kommt ne Fehlermeldung. Das Bild is auch n 24-BitMap.

Weiß einer was dazu?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 11.04.08 15:10 
user profile icon´|` R /\ I | ) O $ hat folgendes geschrieben:
Er bricht aber immer ab, also es kommt ne Fehlermeldung.
Das liegt an der Clustergröße deiner Festplatte. Guck mal, obs funktioniert, wenn du das Bild von einer Diskette lädst. :nixweiss:

Nebenbei...du hast den Dateinamen hier gekürzt, oder? Denn die Datei, die du da angibst, dürfte kaum existieren.

_________________
We are, we were and will not be.
´|` R /\ I | ) O $ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 62



BeitragVerfasst: Fr 11.04.08 15:13 
Ah ok, ich habs ;-)