Autor Beitrag
christian87
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45



BeitragVerfasst: Fr 19.01.07 14:49 
Hallo ich will ein image an eine bestimmte Stelle in einer PaintBox laden.
Ich hab das so versucht:

paintbox1.canvas.draw(100,200,'ball.bmp')

Funktioniert aber nicht!
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Fr 19.01.07 15:27 
Wieso funktionierts denn nicht? ^^
Nein, kommt ein Fehler, Laufzeitfehler? Oder wird es einfach nicht gezeichnet?

Der Dateipfad stimmt oder?
Lossy eX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1048
Erhaltene Danke: 4



BeitragVerfasst: Fr 19.01.07 16:08 
Ähmmmm. Der Befehl Draw möchte keinen String sondern ein Objekt des Typen TGraphic! Der Code oben lässt sich also nicht mal übersetzen.

Du musst also erst einmal ein Bild laden um dieses Darstellen zu können. Der Quellcode ist geringfügig gekürzt also bitte darauf achten.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
type
  TForm1 = class(TForm)
  private
    fPicture: TPicture;
  end;

implementation

procedure TForm1.FormCreate(Sender: TObject);
begin
  fPicture := TPicture.Create;
  fPicture.LoadFromFile('Blahhh.bmp');
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  FreeAndNil(fPicture);
end;

procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
  PaintBox1.Canvas.Draw(100100, fPicture.Graphic);
end;


PS: Die Aussage "Funktioniert nicht" ist im übrigen alles andere als Aussagekräftig. In deinem Falle ist der Code Aussage genug aber bitte demnächst etwas genauer werden. Danke.

_________________
Nur die Menschheit ist arrogant genug, um zu glauben sie sei die einzige intelligente Lebensform im All. Wo nicht mal das nachhaltig bewiesen wurde.