Autor Beitrag
Bethsoftfan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP, Linux OpenSuSE 10.3 mit Compiz Fusion :cool:
Delphi 2007 Prof. Delphi 5
BeitragVerfasst: Do 24.01.08 18:51 
Wie kann man erkennen, ob auf einer Fläche in einer TScrollbox schon ein TImage liegt?

Mit length gehts irgentwie nit...

PS : suche ergab nichts!

Danke für antworten
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Do 24.01.08 19:01 
Also das sollte man jetzt mal wieder etwas genauer formulieren!
Schäm dich Felix^^ tststs...

Naja also... Es geht mal wieder um das (bei manchen schon bekannte) Spiel.

Wir haben es jetzt geschafft, das die Images auf der Karte dargestellt werden, jedoch kann man diese noch übereinander bauen...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Cursorposx := ScreenToClient(Mouse.CursorPos).X;
cursorposy := ScreenToClient(Mouse.CursorPos).Y;
  Setlength(FImages, length(FImages)+1);
  FImages[length(FImages)-1]:= TImage.Create(self);
  FImages[length(FImages)-1].Name:= 'Kaserne'+InttoStr(length(FImages));
  FImages[length(FImages)-1].Parent:= Mainmapscrollbox;
  FImages[length(FImages)-1].height:= 20;
  FImages[length(FImages)-1].width:= 50;
  FImages[length(FImages)-1].Left:= CursorPosX;
  FImages[length(FImages)-1].Top:= CursorPosY;
  FImages[length(FImages)-1].Picture.LoadfromFile('C:\Dokumente und Einstellungen\Philipp\Eigene Dateien\staemme.jpg');
  Mainmap.Enabled := false;
  Mainmap.Visible := true;


Wie kann ich jetzt ne If-Abfrage da einbauen, die abfragt, ob schon ein Gebäude an der Stelle steht?

Das ganze soll in ner Schleife

ausblenden Delphi-Quelltext
1:
2:
for i := 1 to length(FImages) do
//if-abfrage


stehen, damit jedes Gebäude überprüft wird!

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Jann1k
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 866
Erhaltene Danke: 43

Win 7
TurboDelphi, Visual Studio 2010
BeitragVerfasst: Do 24.01.08 19:37 
schau doch einfach ob die x/y werte mit den werten des cursors übereinstimmen, wenn ja steht da schon ein gebäude
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Do 24.01.08 20:37 
*bin zu faul zum lesen^^*
sind die Gebäude Objekte?
Dann mach doch 'ne function getroffen(h,v) rein.
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Do 24.01.08 21:02 
Die Gebäude sind TImages.
Wir wissen ja nicht wie wir die Images ansprechen sollen!

So geht das nicht:

ausblenden Delphi-Quelltext
1:
Kaserne+IntToStr(length(FImages)).top					


leider...

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Do 24.01.08 21:15 
Ich bastel grad an ner Lösung...
Vielen Dank! Wenn sie fertig ist werde ich sie posten!

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Do 24.01.08 22:09 
user profile iconSoapy hat folgendes geschrieben:
Die Gebäude sind TImages.
Wir wissen ja nicht wie wir die Images ansprechen sollen!

So geht das nicht:

ausblenden Delphi-Quelltext
1:
Kaserne+IntToStr(length(FImages)).top					


leider...


In dem Quellcode aus deinem ersten Post greifst du doch auch schon auf die Images zu - was ist denn daran jetzt anders?
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Do 24.01.08 22:42 
Jup vielen Dank!
Ich habs jetzt gelöst!
Aber wenn ich dann wenn ich diese Schleife hier ausführe -

ausblenden volle Höhe 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:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
while x <= length(FImages) do
x := x+1;
begin
if length(FImages) = 0 Then
  begin
    Setlength(FImages, length(FImages)+1);
    FImages[length(FImages)-1]:= TImage.Create(self);
    FImages[length(FImages)-1].Name:= 'Kaserne'+InttoStr(length(FImages));
    FImages[length(FImages)-1].Parent:= Mainmapscrollbox;
    FImages[length(FImages)-1].height:= 20;
    FImages[length(FImages)-1].width:= 50;
    FImages[length(FImages)-1].Left:= CursorPosX;
    FImages[length(FImages)-1].Top:= CursorPosY;
    FImages[length(FImages)-1].Picture.LoadfromFile('C:\Dokumente und Einstellungen\Philipp\Eigene Dateien\staemme.jpg');
    Mainmap.Enabled := false;
    Mainmap.Visible := true;
    Label1.Caption := FImages[length(FImages)-1].Name;
  end

  else
  if (FImages[Anzahl-1].top >= FImages[x].Top+50then
    begin
    x := x-2;
    label1.Caption := 'gut';
    end
  else
    begin
      Setlength(FImages, length(FImages)+1);
      FImages[length(FImages)-1]:= TImage.Create(self);
      FImages[length(FImages)-1].Name:= 'Kaserne'+InttoStr(length(FImages));
      FImages[length(FImages)-1].Parent:= Mainmapscrollbox;
      FImages[length(FImages)-1].height:= 20;
      FImages[length(FImages)-1].width:= 50;
      FImages[length(FImages)-1].Left:= CursorPosX;
      FImages[length(FImages)-1].Top:= CursorPosY;
      FImages[length(FImages)-1].Picture.LoadfromFile('C:\Dokumente und Einstellungen\Philipp\Eigene Dateien\staemme.jpg');
      Mainmap.Enabled := false;
      Mainmap.Visible := true;
      Label1.Caption := FImages[length(FImages)-1].Name;
    end;
end;
end;


- und dieser Teil -

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  if (FImages[Anzahl-1].top >= FImages[x].Top+50then
    begin
    x := x-2;
    label1.Caption := 'gut';
    end



- ausgeführt wird blockiert das Programm den "Bau" neuer Häuser!
Man soll danach aber noch Häuser bauen können!
Sieht jemand das Problem?
Ich sehs nach langer Sucherei nicht!
Sorry falls was unklar ist!
Is so viel Code hier drin!

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
icho2099
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 101
Erhaltene Danke: 12

WIN XP, WIN 7, WIN 10
Delphi 6 Prof, Delphi 2005, FPC
BeitragVerfasst: Fr 25.01.08 17:51 
wie wäre es denn, wenn du bei den dynamisch erstellten TImages einfach
das OnClick mit einer Methode verknüpfen würdest ?

Klickst du dann auf eine besetzte Stelle, dann reagiert das TImage, welches den
Platz belegt, selber.
Du brauchst dann nicht mühsam rausfinden, welches das ist, das erledigt die VCL
für dich.
In der Methode kannst du dann ja entsprechend reagieren.
Hier ein Beispiel wie man das macht:

ausblenden volle Höhe 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:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private-Deklarationen }
    ExePath    : String;

    Procedure IMOnClick(Sender : TObject);
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
  (* Exepath weil ich die Bilder da liegen habe *)
  ExePath  := ExtractFilePath(Application.ExeName)+'\';
  Randomize;
end;

(* dies ist die Methode, die mit den OnClick Ereignissen *)
(* der dynamisch erzeugten TImages verbunden werden muss *)
Procedure TForm1.IMOnClick(Sender : TObject);
begin
  Application.MessageBox('hier ist besetzt, klick woanders','D e n k s t e',0);
end;

procedure TForm1.FormMouseDown(Sender : TObject;
                               Button : TMouseButton;
                               Shift  : TShiftState;
                               X, Y   : Integer);
Var IM      : TImage;
    IMFName : String;  (* Dateiname für Picture *)
    rx      : Integer;
begin
  (* aus drei möglichen Bildern eines zufällig auswählen *)
  rx := Random(100);
  If rx <= 33 then IMFName := '1.ico' else
  If rx <= 66 then IMFName := '2.ico' else
                   IMFName := '3.ico';
  IMFName := ExePath+IMFName;

  (* neues TImage *)
  IM := TImage.Create(Self);
  (* an Klickposition *)
  IM.Left := X; IM.Top := Y;
  (* Bild laden *)
  IM.Stretch  := False;
  IM.AutoSize := True;
  IM.Picture.LoadFromFile(IMFName);
  IM.Parent := Self;
  (* und hier wird das Onclick des neuen TImage mit der Methode verbunden *)
  IM.OnClick := IMOnClick;
end;

end.
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Fr 25.01.08 18:36 
Huh...
Das sieht ja geil aus!
Ich werde es mal ausprobieren!
Vielen Dank!

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Fr 25.01.08 23:57 
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:
24:
25:
26:
27:
28:
29:
Procedure TForm1.IMOnClick(Sender : TObject);
begin
  Application.MessageBox('hier ist besetzt, klick woanders','D e n k s t e',0);
end;

procedure TForm1.MainMapMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
Var IM      : TImage;
    IMFName : String;  (* Dateiname für Picture *)
    rx, i, z     : Integer;
begin
  i := i+1;
  if IM.Name = 'Kaserne' Then
    IM.Name := 'Kaserne'+IntToStr(i);
  IM := TImage.Create(Self);
  (* an Klickposition *)
  IM.Left := X-25;
  IM.Top := Y-25;
  (* Bild laden *)
  IM.Stretch  := False;
  IM.AutoSize := False;
  IM.Width := 50;
  IM.Height := 50;
  IM.Picture.LoadFromFile('C:\Dokumente und Einstellungen\Philipp\Eigene Dateien\staemme.jpg');
  IM.Parent := MainmapScrollbox;
  (* und hier wird das Onclick des neuen TImage mit der Methode verbunden *)
  IM.OnClick := IMOnClick;
  Mainmap.Enabled := false;
end;


So jetzt kann man sie nicht mehr direkt übereinander bauen aber die Bilder überlappen sich noch um höchstens 25px.
Wie lässt sich das vermeiden?

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Sa 26.01.08 00:20 
user profile iconSoapy hat folgendes geschrieben:
So jetzt kann man sie nicht mehr direkt übereinander bauen aber die Bilder überlappen sich noch um höchstens 25px.
Wie lässt sich das vermeiden?

Spontan würd ich sagen das Bild groesser machen als schlichte Lösung.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 26.01.08 01:27 
user profile iconSoapy hat folgendes geschrieben:
So jetzt kann man sie nicht mehr direkt übereinander bauen aber die Bilder überlappen sich noch um höchstens 25px.
Wie lässt sich das vermeiden?


Schau dir doch mal deinen Source an...
Das neue Bild setzt du an die X Position X - 25.
d.h. wenn du direkt rechts neben ein Bild klickst, wird das neue noch 25 Pixel nach links verschoben, und liegt somit halb über dem alten...

Abhilfe schafft es nur, wenn du diese 25px mit einberechnest, in deine Kollisionsabfrage..
Oder dort wo geklickt wird, landet die obere linke Ecke des Gebäudes - und nicht die Mitte.
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Sa 26.01.08 11:13 
Ich hab ja keine Kollisionsabfrage, nur die onclick-Ereignisroutine für die selbsterzeugenden Images!

Wenn ich jetzt mit dem obenstehenden Code 5 Images erzeuge, wie kann ich dann zum Beispiel die Koordinaten des dritten Abfragen, um diese in der Kollisionsabfrage mit anderen zu vergleichen?

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Sa 26.01.08 14:28 
ausblenden volle Höhe 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:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
procedure TForm1.MainMapMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
Var IMFName : String;  (* Dateiname für Picture *)
    z       : Integer;
begin
  if length(FImages) = 0 then
  begin
    Setlength(FImages, length(FImages)+1);
    FImages[length(FImages)-1]:= TImage.Create(self);
    FImages[length(FImages)-1].Name:= 'Kaserne'+InttoStr(length(FImages));
    FImages[length(FImages)-1].Parent:= MainmapScrollbox;
    FImages[length(FImages)-1].height:= 20;
    FImages[length(FImages)-1].width:= 50;
    FImages[length(FImages)-1].Left:= X;
    FImages[length(FImages)-1].Top:= Y;
    FImages[length(FImages)-1].Picture.LoadfromFile('C:\Dokumente und Einstellungen\Philipp\Eigene Dateien\staemme.jpg');
    FImages[length(FImages)-1].OnClick := IMonclick;
    Mainmap.Enabled := false;
  end
else
  begin
    for z := 0 to length(FImages) do
    begin
      if FImages[length(FImages)-z].top > (FImages[length(FImages)].top+FImages[length(FImages)].height) then
        begin showmessage('geht nicht'end
        else
        begin
          Setlength(FImages, length(FImages)+1);
          FImages[length(FImages)-1]:= TImage.Create(self);
          FImages[length(FImages)-1].Name:= 'Kaserne'+InttoStr(length(FImages));
          FImages[length(FImages)-1].Parent:= MainmapScrollbox;
          FImages[length(FImages)-1].height:= 20;
          FImages[length(FImages)-1].width:= 50;
          FImages[length(FImages)-1].Left:= X;
          FImages[length(FImages)-1].Top:= Y;
          FImages[length(FImages)-1].Picture.LoadfromFile('C:\Dokumente und Einstellungen\Philipp\Eigene Dateien\staemme.jpg');
          FImages[length(FImages)-1].OnClick := IMonclick;
          Mainmap.Enabled := false;
        end;
      end;
  end;
end;


So ich hab das jetzt so gelöst...

Doch leider gibt es mir immer wieder einen Fehler aus, wenn ich das zweite Image erstellen will, alse der Else-Teil ausgeführt wird.
Sieht jemand woran das liegt?

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 26.01.08 14:52 
user profile iconSoapy hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
      if FImages[length(FImages)-z].top > (FImages[length(FImages)].top+FImages[length(FImages)].height) then
....
          FImages[length(FImages)-1]:= TImage.Create(self);



Schreib doch BITTE grundsätzlich die Fehlermeldung dazu..

Und vergleich mal die beiden markierten Blöcke, da steckt der Fehler drin.
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Sa 26.01.08 15:00 
Leider steckt der Fehler dort nicht drin!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
if FImages[length(FImages)-z].top > (FImages[length(FImages)-1].top+FImages[length(FImages)-1].height) then
        begin showmessage('geht nicht'end
        else
        begin
          Setlength(FImages, length(FImages)+1);
          FImages[length(FImages)-1]:= TImage.Create(self);
          FImages[length(FImages)-1].Name:= 'Kaserne'+InttoStr(length(FImages));
          FImages[length(FImages)-1].Parent:= MainmapScrollbox;
          FImages[length(FImages)-1].height:= 20;
          FImages[length(FImages)-1].width:= 50;
          FImages[length(FImages)-1].Left:= X;
          FImages[length(FImages)-1].Top:= Y;
          FImages[length(FImages)-1].Picture.LoadfromFile(ExePath+'staemme.jpg');
          FImages[length(FImages)-1].OnClick := IMonclick;
          Mainmap.Enabled := false;
        end;


Habe es jetzt so geändert...

Für die Zukunft werde ich mir merken dass ich die Fehlermeldung dazu schreib!
Nunja, hier ist sie:
Zitat:
Zugriffsverletzung bei Adresse 0046D01F in Modul 'Strategie.exe'. Lesen von Adresse 0000005A.

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 26.01.08 16:51 
2 von 3 Fehlern hast du korrigiert..
bleibt noch das z, dass im ersten Schleifendurchlauf ebenfalls den Wert 0 hat ;)

BTW: Für sowas gibts den Debugger.. Haltepunkte, Variableninhalt anschauen, und solche Sachen.
icho2099
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 101
Erhaltene Danke: 12

WIN XP, WIN 7, WIN 10
Delphi 6 Prof, Delphi 2005, FPC
BeitragVerfasst: Sa 26.01.08 17:10 
Dein Schleifenzähler z läuft um eine Position zu weit.

ausblenden Delphi-Quelltext
1:
for z := 0 to length(FImages) do					


Das Array ist von 0 bis Length(Array)-1 indiziert.

Der Zugriff auf das Length(..)te Arrayelement liefert die Exception, weil die
dort im Speicher stehenden 4 Bytes nicht auf ein TImage verweisen, sondern auf
nicht zugewiesenen Speicher.

Also:
ausblenden Delphi-Quelltext
1:
for z := 0 to (length(FImages)-1do					


das sollte dann fehlerfrei laufen.

Um die Kollisionen mit allen TImages zu erkennen, bieten sich die Funktionen
InterSectRect und IsRectEmpty aus der Unit Types an.

IntersectRect mit dem Rechteck des neuen TImage gegen alle schon existierenden
Rechtecke bilden und das Ergebnis jeweils mit IsRectEmpty prüfen.
Ist IsRectEmpty=True für alle Prüfungen, dann gibt es keine Überschneidung des
neuen Rechtecks mit bereits bestehenden und die Fläche ist frei.
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Sa 26.01.08 17:35 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
    for z := 0 to (length(FImages)-1do
    begin
      if FImages[length(FImages)-z].top > (FImages[length(FImages)-1].top+FImages[length(FImages)-1].height) then
        begin showmessage('geht nicht'end
        else
        begin
          Setlength(FImages, length(FImages)+1);
          FImages[length(FImages)-1]:= TImage.Create(self);
          FImages[length(FImages)-1].Name:= 'Kaserne'+InttoStr(length(FImages));
          FImages[length(FImages)-1].Parent:= MainmapScrollbox;
          FImages[length(FImages)-1].height:= 20;
          FImages[length(FImages)-1].width:= 50;
          FImages[length(FImages)-1].Left:= X;
          FImages[length(FImages)-1].Top:= Y;
          FImages[length(FImages)-1].Picture.LoadfromFile(ExePath+'staemme.jpg');
          FImages[length(FImages)-1].OnClick := IMonclick;
          Mainmap.Enabled := false;
        end;
    end;


So?
Leider geht das auch nicht!
Aber die Zahlen in der Fehlermeldung haben sich verändert:

Zitat:
Zugriffsverletzung bei Adresse 0046D020 in Modul 'Strategie.exe'. Lesen von Adresse 0000005A.


Ich werde mal die andere Methode ausprobieren!
Vielen Dank für die Antworten!

_________________
Linux wird nie das meistinstallierte Betriebssystem sein, wenn man bedenkt, wie oft man Windows neu installieren muss!