Autor Beitrag
Noinini
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Fr 16.03.07 00:01 
Hallo!

Ich hab da mal n Problem. Also: Ich hab nicht wirklich viel Ahnung von Informatik und Delphi, ich habe nämlich erst angefangen, mich damit zu beschäftigen.
Nun hatte ich vor, ineinandergeschachtelte Kreise im Abstand von 5 Pixeln auf eine Leinwand zu bekommen.
Ich hatte vor, dazu 4 Variablen zu benutzen und eine Repeat-Schleife.
Vor nem viertel Jahr habe ich das Vorhaben noch erfolgreich abgeschlossen, wahrscheinlich aber eher aus Zufall, jetzt bekomme ich das nicht mehr hin.
Kann mir wer helfen?

Thx in advance :)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 16.03.07 00:12 
Moin und :welcome: im Forum!

Hier gibt es sicher immer welche, die dir helfen können und wollen. :D

Allerdings: du hast dein Problem gar nicht beschrieben, was klappt denn nicht? :gruebel:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Noinini Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Fr 16.03.07 15:46 
was nicht läuft? Ja wenn ich das wüsste... :D

also das ist das was ich bisher als Quelltext habe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
var x1,x2,y1,y2 : Integer;
begin
with Image1.Canvas do
begin
  x1:=250;
  x2:=200;
  y1:=200;
  y2:=150;
  repeat
    x1:=x1-5;
    x2:=x2+5;
    y1:=y1-5;
    y2:=y2+5;
  until x1=100;
  Ellipse (x1,y1,x2,y2);
end;
end;



was dabei rauskommt, ist ein simpler kreis. Und ich habe wirklich keine Ahnung, wie ich's besser machen könnte...
Stehe voll auf'm Schlauch, wie man so schön sagt.. :(

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Fr 16.03.07 16:06 
user profile iconNoinini hat folgendes geschrieben:
was nicht läuft? Ja wenn ich das wüsste... :D

also das ist das was ich bisher als Quelltext habe:

var x1,x2,y1,y2 : Integer;
begin
with Image1.Canvas do
begin
x1:=250;
x2:=200;
y1:=200;
y2:=150;
repeat
x1:=x1-5;
x2:=x2+5;
y1:=y1-5;
y2:=y2+5;
until x1=100;
Ellipse (x1,y1,x2,y2);
end;
end;



was dabei rauskommt, ist ein simpler kreis. Und ich habe wirklich keine Ahnung, wie ich's besser machen könnte...
Stehe voll auf'm Schlauch, wie man so schön sagt.. :(


vertausch mal diese beiden Zeilen
ausblenden Delphi-Quelltext
1:
2:
until x1=100;
Ellipse (x1,y1,x2,y2);


so wie du es jetzt hast, geht er zuerst die Schleife durch und mal dann eine Ellipse, die soll doch aber wohl in jedem schleifendurchgang gemalt werden, oder?

so sollte es gehen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
var x1,x2,y1,y2 : Integer;
begin
with Image1.Canvas do
begin
x1:=250;
x2:=200;
y1:=200;
y2:=150;
repeat
x1:=x1-5;
x2:=x2+5;
y1:=y1-5;
y2:=y2+5;
Ellipse (x1,y1,x2,y2);
until x1=100;
   end;
   end;
]

_________________
mfg. Joel
Noinini Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Do 22.03.07 09:20 
Thx für die Antwort. Funktioniert so allerdings nicht ;)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
var x1, x2, y1, y2 : Integer ;
begin
  with Image1.Canvas do
  begin
    x1:=150;
    y1:=0;
    x2:=450;
    y2:=300;
    repeat
      x1:=x1+5;
      begin
        x2:=x2-5;
        y1:=y1+5;
        y2:=y2-5;
        Ellipse (x1,y1,x2,y2);
      end;
    until x1=300;
  end;
end


So allerdings gehts ;) Hat sich also erledigt... Trotzdem danke :)

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Do 22.03.07 10:40 
Hi!

Einen Tipp möchte ich dir gerne noch auf den Weg geben: Formatiere einen Quellcode. Das erhöht die Übersichtlichkeit enorm.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
var x1, x2, y1, y2 : Integer ;
begin
  with Image1.Canvas do
  begin
    x1 := 150;
    y1 := 0;
    x2 := 450;
    y2 := 300;
    
    repeat
      x1 := x1 + 5;
      begin
        x2 := x2 - 5;
        y1 := y1 + 5;
        y2 := y2 - 5;
        Ellipse (x1, y1, x2, y2);
      end;
    until x1 = 300;
  end;
end;


Was meinst du?

Ansonsten such doch mal nach dem Delphi StyleGuide. Da stehen einige "Richtlinien" drin, an die sich eigentlich die meisten Programmierer halten.

Gruß