Autor Beitrag
u-schas
Hält's aus hier
Beiträge: 9

Windows XP Home
Delphi 6
BeitragVerfasst: Mo 13.06.05 13:23 
Ich habe eine Paintbox, in der sollen Punkte eingetragen werden und diese Punkte sollen miteinander verbunden werden. Klappt auch meistens, aber manchmal lässt er beim verbinden einfach einen Punkt aus, warum. Das ganze sieht bei mir folgendermaßen aus:
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:
//Kontrollpunkte ausgeben
P1:= kontrollpunktzu(1);
 for i:= 1 to getAnzahl_Punkte do
 begin
 n := kontrollpunktzu(i);
 Pixel_x:=((n.x-(getmin_x-1))* Abstand_x)+Rand;
 Pixel_y:=paintbox1.Height-Rand-(n.y-getmin_y+1)*Abstand_y;


        // Pixel größer sichtbar machen
        for x:= round(pixel_x)-1 to round(pixel_x)+1 do
        for  y:= round(pixel_y)-1 to  round(pixel_y)+1 do
 paintbox1.Canvas.Pixels[x,y]:=clred;
        p.x := x;
        p.Y := y;
        kontrollpixelaus(p,i);

   //Pixel verbinden
   m:= kontrollpunktzu(i) ;
   if (m.x <> P1.x) and (m.y <> P1.y) then
   begin
   Pixel_m.x:=((m.x-(getmin_x-1))* Abstand_x)+Rand;
   Pixel_m.y:=paintbox1.Height-Rand-(m.y-getmin_y+1)*Abstand_y;
   Pixel_P1.x:=((P1.x-(getmin_x-1))* Abstand_x)+Rand;
   Pixel_P1.y:=paintbox1.Height-Rand-(P1.y-getmin_y+1)*Abstand_y;
   paintbox1.canvas.pen.Color:= clred;
   paintbox1.Canvas.MoveTo(trunc(Pixel_P1.x)+1,trunc(Pixel_P1.y)+1);
   paintbox1.Canvas.lineto(trunc(Pixel_m.x)+1,trunc(Pixel_m.y)+1);
   P1.x := m.x;
   P1.y := m.y;
   paintbox1.Canvas.Pen.Color:= clblack;
   end;


Ich sehe da einfach keinen Fehler und vor allem verstehe ich nicht, das er es manchmal macht und macnhmal nicht?????

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Mottor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mo 13.06.05 17:51 
Vielleicht :
ausblenden Delphi-Quelltext
1:
if (m.x <> P1.x) OR (m.y <> P1.y) then