Autor Beitrag
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 18.04.07 22:28 
user profile iconSchnuppe hat folgendes geschrieben:
hm, ich weiß im moment nicht wie genau diese schleife aussehen soll.
Und zwischen Deinem und Narses' Posting liegen ja auch ganze zwei Minuten! Das nenne ich gründlich nachdenken :zustimm:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 22:29 
...ich kann nimmer, hab doch keine ahnung... :oops:

for to schleife.....

wenns die ist dann weiß ich immer noch nicht wie die aussehen soll. :?:
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 22:32 
Moin!

OK, die for-Schleife ist schonmal gut. Die hat eine untere und eine obere Grenze. Welche könnten da in Frage kommen? Hier nochmal dein Code zum Aufzeichnen der Punkte von weiter oben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;  
  Shift: TShiftState; X, Y: Integer);  
begin  
  if (button = mbleft) then begin  
    n := n+1;  
    xp[n] := x;  
    yp[n] := y;  
    image1.Canvas.Rectangle(x-7,y-7,x+7,y+7);  
  end;  
end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 22:37 
ich weiß es beim besten willen nicht. (weil ich mir im moment unter "grenze" nicht wirklich was vorstellen kann.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 22:39 
Moin!

Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
  i: Integer;

begin
  for i := 1 to 3 do
    ShowMessage(IntToStr(i));

Pack das mal in den Button-Klick-Handler und lass das Ding laufen, dann klick auf den Button. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 22:45 
...du bist lieb, aber mein problem damit nicht gelöst. leider. ich hab jetzt einfach einen hänger.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 22:49 
Moin!

user profile iconSchnuppe hat folgendes geschrieben:
...du bist lieb,

Oh, danke. :angel:

user profile iconSchnuppe hat folgendes geschrieben:
aber mein problem damit nicht gelöst. leider. ich hab jetzt einfach einen hänger.

Tja, scheint fast so. :?

Allerdings, damit wir uns richtig verstehen: du kriegst keinen Code (=Lösung) von mir, egal was du sagst. :P

Wir entwickeln hier die Lösung zusammen oder nicht, wie du möchtest. :nixweiss:

Falls du also noch Bock hast: Den Test-Code ausprobiert? ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 22:52 
...ja hab ich. da funktionierts halt. ich müßte in die variablen noch das i aufnehmen (habsch gemacht), habe nun gesagt:

for i=1 to n do
image1.Canvas.Rectangle(x-7,y-7,x+7,y+7);

aber mit dem x und dem y hat das ja nicht hin.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 22:54 
Moin!

user profile iconSchnuppe hat folgendes geschrieben:
...ja hab ich. da funktionierts halt. ich müßte in die variablen noch das i aufnehmen (habsch gemacht), habe nun gesagt:
ausblenden Delphi-Quelltext
1:
2:
for i=1 to n do
 image1.Canvas.Rectangle(x-7,y-7,x+7,y+7);

aber mit dem x und dem y hat das ja nicht hin.

Das ist ansich auch OK, aber du musst doch die aufgezeichneten Koordinaten aus deinem Speicher verwenden. :idea: Wie heißt denn dein Speicher... ? ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 22:57 
array heißt der gute...aber wie ich mich auf den beziehe....
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 23:01 
Moin!

OK, schauen wir nochmal sehr GENAU hier hin: ;)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;    
  Shift: TShiftState; X, Y: Integer);    
begin    
  if (button = mbleft) then begin    
    n := n+1;    
    xp[n] := x;    
    yp[n] := y;    
    image1.Canvas.Rectangle(x-7,y-7,x+7,y+7);    
  end;    
end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 23:05 
also so?:

for i=1 to n do
image1.Canvas.Rectangle(xp-7,yp-7,xp+7,yp+7);
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 23:06 
Sieht das dem Code oben ähnlich genug? :gruebel: Oder könnte da nicht vielleicht noch eine Angabe fehlen, WELCHEN Eintrag aus dem Array du meinst? (weil: wozu sonst die Schleife?) :roll:

_________________
There are 10 types of people - those who understand binary and those who don´t.
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 23:22 
array [1..30]...
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 23:27 
user profile iconSchnuppe hat folgendes geschrieben:
array [1..30]...

Damit definierst du die Größe des Feldes. Nochmal: wozu ist die Schleife da?

//EDIT: Der Code hier ist schon fast korrekt, es fehlt nur noch was (1 Syntax- und 1 Logikfehler sind noch drin)... ;)
ausblenden Delphi-Quelltext
1:
2:
for i=1 to n do 
  image1.Canvas.Rectangle(xp-7,yp-7,xp+7,yp+7);

_________________
There are 10 types of people - those who understand binary and those who don´t.
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 18.04.07 23:35 
ich werde im schlaf darüber nachdenken und mich wieder melden.

die schleife sagt aus: führe von einem anfangs bis endwert (in dem falle n mal) immer das selbe durch.

ich tendiere dazu das p rauszunehmen.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.04.07 23:42 
Moin!

user profile iconSchnuppe hat folgendes geschrieben:
die schleife sagt aus: führe von einem anfangs bis endwert (in dem falle n mal) immer das selbe durch.

Fast richtig: setze i auf den Anfangswert und führe die Anweisungen in der Schleife aus, dann erhöhe i um 1 und prüfe, ob der Endwert überschritten ist; wenn der Endwert noch nicht überschritten ist, führe erneut die Anweisungen in der Schleife aus, erhöhe i um 1, prüfe, usw. usf...

user profile iconSchnuppe hat folgendes geschrieben:
ich tendiere dazu das p rauszunehmen.

Dein Speicher heisst aber so (xp,yp: array...), kann nicht richtig sein. :mahn: Du hast also doch noch nicht GENAU GENUG hier hingesehen: 8)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;      
  Shift: TShiftState; X, Y: Integer);      
begin      
  if (button = mbleft) then begin      
    n := n+1;      
    xp[n] := x;      
    yp[n] := y;      
    image1.Canvas.Rectangle(x-7,y-7,x+7,y+7);      
  end;      
end;


user profile iconSchnuppe hat folgendes geschrieben:
ich werde im schlaf darüber nachdenken und mich wieder melden.

Das hört sich gut an! ;) Bis morgen... :gaehn:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Do 19.04.07 01:18 
Narses, du solltest Informatiklehrer werden :rofl:

Ne echt jetzt, hast du echt gut gemacht, find ich. :!:
Schnuppe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Do 19.04.07 05:11 
moin,

also (xp[n]-7,yp[n]-7.....)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 19.04.07 08:10 
Moin!

Yip, so ähnlich sollte das dann wohl aussehen. Zeig mal den ganzen Button-Handler. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.