Hi Leute,
ich arbeite mich fleißig in C# rein. Nur stoße ich auf ein Problem:
Ich möchte gerne Soduko nachprogrammieren. Die Zahlen für das Feld will ich über einen Button-Kreis eingeben können, der um das Feld erscheint. Hier der Quelltext:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| public class Eingabekreis : Object { public Eingabekreis(int xPos, int yPos) { int Radius = 50; ArrayList EingabebuttonListe = new ArrayList(); for (int i = 1; i < 10; ++i) { Button Eingabebutton = new Button(); Eingabebutton.Text = i.ToString(); int x,y; x = (int)(Math.Sin(2/9*Math.PI*i)*Radius+xPos); y = (int)(Math.Cos(2/9*Math.PI*i)*Radius+yPos);
Eingabebutton.Location.X = x; Eingabebutton.Location.Y = y;
EingabebuttonListe.Add(Eingabebutton); } } } |
Das Problem ist nun das der Compiler mir folgendes sagt:
'Der Rückgabewert von "System.Windows.Forms.Control.Location" kann nicht geändert werden, da er keine Variablie ist'
Wo steckt da der Fehler oder gibt es vielleicht noch eine Alternative?
Eine Frage wäre da noch
Um selbstdefiniertes Objekt auf dem Formular anzuzeigen brauchte man in Delhpi "parent".
Wie stellt man das in C# an?
Vielen Danke
Liebe Grüße
Chris