Autor Beitrag
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Di 24.08.04 19:45 
hallo ich stehe (mal wieder) vor einem problem

und zwar.... wenn man form1 anklickt soll an der stelle wo man geklickt hat ein bild angzeigt werden... auch mehrere verschiedene nebeneinander......
ist das möglich? oder muss ich das über Timages machen?
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Di 24.08.04 20:15 
Oh nein, schon wieder durch Punkte getrennte Satzfragmente :mrgreen:
Also, du kannst von TForm das Ergebnis OnMouseDown benutzen. Dort bekommst du die Variablen X und Y mit welchen du dann z.B. mit Canvas zeichnen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var BMP:TBitmap;
begin
 BMP:=TBitmap.Create;
 try
  BMP.LoadFromFile('C:\Workspace\Eigene Bilder\16 zu 9.bmp');
  Canvas.Draw(X,Y,BMP);
 finally
  BMP.Free;
 end;

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
DarkHunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Mi 25.08.04 17:12 
ok danke
damit lässt sich was machen.
Das wars schon
DarkHunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Mi 25.08.04 22:27 
schön das dingt funktioniert ........
aber
wenn ich ein anderes fenster in der fordergrund hole verschwinden die bilder wieder... wie kann ich das ändern?
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 26.08.04 16:31 
Das ist das Problem bei einem Canvas. Du bist für das Neuzeichnen selber zuständig
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:
var Form1: TForm1;
    OldPos: TPoint; // Global deklarieren

{...}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;  
  Shift: TShiftState; X, Y: Integer);  
begin
 OldPos:=Point(X,Y);
 Invalidate;
end;

procedure TForm1.FormPaint(Sender: TObject);
var BMP:TBitmap;  
begin  
 BMP:=TBitmap.Create;  
 try  
  BMP.LoadFromFile('C:\Workspace\Eigene Bilder\16 zu 9.bmp');  
  Canvas.Draw(OldPos.X,OldPos.Y,BMP);  
 finally  
  BMP.Free;  
 end;

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.