Autor Beitrag
walter_b
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 135

Windows Vista/XP
Delphi 6
BeitragVerfasst: Mi 12.03.08 17:48 
Hallo zusammen...

Bei mir taucht immer diese dämliche Fehlermeldung auf, wenn ich in meinem Delphi-Programm etwas in den folgenden Array speichern will:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
  for Iy:=0 to BMlength do begin
    for Ix:=0 to BMlength do begin
      Bx:=(abs(Ix-BMhalf));
      By:=(abs(Iy-BMhalf));
      Bradius:=round(sqrt(sqr(Bx)+sqr(By)));
      if (Bradius<=BR) AND (Bradius>=IBR) then begin
      form1.Image8.Canvas.Pixels[Ix,Iy]:=clNavy;
      ax[I]:=Ix;
      ay[I]:=Iy;
      I:=I+1;
      end
      else begin
      form1.Image8.Canvas.Pixels[Ix,Iy]:=clRed;
      end;
    end;
  end;


Variabeln sind so definiert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var                                                                          
I, I1, I2, Ix, Iy, Bx, By, Bradius, BMhalf: integer;

und

 ax, ay: array of integer;


Wo liegt das Problem?

(Ich erspar euch den ganzen Programmcode, ist nämlich ziemlich lange... Die Fehlermeldung taucht wie gesagt direkt nach dem ersten mal speichern in den Array auf und in der Grafik ist dann dieser einzelne Navy-farbene Punkt sichtbar.


Danke für eure Hilfe


Edit: Genaue Fehlermeldung:
Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 004590CD in module 'Project1.exe'. Write of address 00000000'. Process stopped. Use Step or Run to continue.
walter_b Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 135

Windows Vista/XP
Delphi 6
BeitragVerfasst: Mi 12.03.08 18:14 
Titel: Re: ... raised exception class EAccessViolation with message
Hat sich erledigt... Habe vergessen dem Array eine Länge zuzuordnen... :oops: :lol: