Ich habe eine Paintbox, die éin KOS mit Punkten und Kurven ausgeben soll. Das KOS soll schwarz sein und die Punkte und Kurven in anderen Farben. Wenn ich allerdings mein Fenster minimiere oder ein anderes Fenster drüberlege, dann wird auch mein KOS verändert. Woran könnte das liegen?
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: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111:
| Laenge_x:= (getmax_x+1)-(getmin_x-1); Abstand_x:=(paintbox1.Width-(2*Rand)) div trunc(Laenge_x)+1;
Verschiebung_x:= Rand; if getmin_x < 0 then Verschiebung_x:=Rand+(trunc(abs(getmin_x-1))*Abstand_x); paintbox1.Canvas.Brush.color:=clblack; paintbox1.Canvas.moveto(Verschiebung_x,paintbox1.Height-Rand); paintbox1.Canvas.LineTo(Verschiebung_x,Rand);
Laenge_y:= (getmax_y+1)-(getmin_y-1); Abstand_y:=(paintbox1.height-(2*Rand)) div trunc(Laenge_y)+1;
Verschiebung_y:= paintbox1.Height-Rand; if getmin_y < 0 then Verschiebung_y:=Verschiebung_y-((abs(trunc(getmin_y-1)))*Abstand_y); paintbox1.Canvas.Brush.color:=clblack; paintbox1.Canvas.moveto(Rand,Verschiebung_y); paintbox1.Canvas.LineTo(paintbox1.width-Rand,Verschiebung_y);
AnfangZahl:=Rand; for i:=trunc(getmin_x)-1 to (trunc(getmax_x)+1) do begin paintbox1.Canvas.Brush.Color:=clwhite; paintbox1.Canvas.TextOut(AnfangZahl,Verschiebung_y,inttostr(i)); AnfangZahl:=AnfangZahl+Abstand_x; end;
AnfangZahl:=paintbox1.Height-Rand; for i:=trunc(getmin_y)-1 to trunc(getmax_y)+1 do begin paintbox1.Canvas.Brush.Color:=clwhite; paintbox1.Canvas.TextOut(Verschiebung_x-paintbox1.Canvas.TextWidth(floattostr(i)),AnfangZahl,floattostr(i)); AnfangZahl:=AnfangZahl-Abstand_y; end;
for i:= 1 to 1002 do begin n:= punktzu(i); Pixel_x:=((n.x-(getmin_x-1))* Abstand_x)+Rand; Pixel_y:=paintbox1.Height-Rand-(n.y-getmin_y+1)*Abstand_y; paintbox1.Canvas.Pixels[trunc(Pixel_x)+1,trunc(Pixel_y)+1]:=clgreen; end;
n := Casteljauzu(1); Pixel_x:=((n.x-(getmin_x-1))* Abstand_x)+Rand; Pixel_y:=paintbox1.Height-Rand-(n.y-getmin_y+1)*Abstand_y;
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]:=clblack;
tmp := getAnzahl_punkte; i := 0;
for j := 1 to (tmp-1) do begin i := i+1; n := Subdivisionzu(i); i := i + (tmp-j); m := Subdivisionzu(i+1);
Pixel_x:=((n.x-(getmin_x-1))* Abstand_x)+Rand; Pixel_y:=paintbox1.Height-Rand-(n.y-getmin_y+1)*Abstand_y;
Pixel_n.x:=((n.x-(getmin_x-1))* Abstand_x)+Rand; Pixel_n.y:=paintbox1.Height-Rand-(n.y-getmin_y+1)*Abstand_y;
Pixel_m.x:=((m.x-(getmin_x-1))* Abstand_x)+Rand; Pixel_m.y:=paintbox1.Height-Rand-(m.y-getmin_y+1)*Abstand_y;
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]:=clfuchsia; paintbox1.Canvas.Brush.Color:=clblack;
paintbox1.canvas.pen.Color:= clfuchsia; paintbox1.Canvas.MoveTo(trunc(Pixel_n.x)+1,trunc(Pixel_n.y)+1); paintbox1.Canvas.lineto(trunc(Pixel_m.x)+1,trunc(Pixel_m.y)+1);
paintbox1.Canvas.Pen.Color:= clfuchsia; paintbox1.Canvas.Brush.Color:=clblack; end;
n := Casteljauzu(1); Pixel_x:=((n.x-(getmin_x-1))* Abstand_x)+Rand; Pixel_y:=paintbox1.Height-Rand-(n.y-getmin_y+1)*Abstand_y;
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]:=clblack; end; |
Moderiert von
raziel: Code- durch Delphi-Tags ersetzt.