Registriert seit: 8. Nov 2005
Ort: nähe Stuttgart
981 Beiträge
Delphi XE2 Professional
|
Re: Sudoku - For windows
4. Jan 2007, 18:58
hi blablab,
Du hast bestimmt WinXP. Das Problem mit dem Colordialog das du da beschreibst ist mir bekannt.
Da ich selbst aber unter Win 98 entwickle ( und der BUG bei mir nicht ist ) und auf alles WinXP systemem auf denen ich es bisher getestet habe das Problem nicht nachvollziehbar zu erzeugen war, ist der Bug noch drin.
hier mal der Komplette Code der unter Implementation steht. Vielleicht seht ihr ja den Fehler
Delphi-Quellcode:
Implementation
{$R *.DFM}
Uses unit1;
// Anzeigen des Vorschau Fenster's hier sind alle Effecte Hardcoded
Procedure Redraw;
Var
x, y: integer;
Begin
With form2 Do Begin
// Zeichnen der Farbauswahl
For x := 2 To 14 Do
Timage(findcomponent('Image' + inttostr(x))).canvas.Rectangle(0, 0, 30, 13);
// Zeichnen des Vorschau bildes
With image1.canvas Do Begin
x := 6;
y := 6;
// Der Background
pen.color := clblack;
brush.style := bssolid;
brush.color := image14.canvas.brush.color;
Rectangle(0, 0, 193, 193);
// das Gitter, bzw die Hintergünde des Gitters
pen.color := image9.canvas.brush.color;
brush.color := image2.canvas.brush.color;
rectangle(x, y, x + 60, y + 60);
brush.color := image6.canvas.brush.color;
rectangle(x + 60, y, x + 120, y + 60);
rectangle(x, y + 60, x + 60, y + 120);
brush.color := image3.canvas.brush.color;
rectangle(x + 120, y, x + 180, y + 60);
brush.color := image5.canvas.brush.color;
rectangle(x + 60, y + 60, x + 120, y + 120);
rectangle(x + 120, y + 60, x + 180, y + 120);
rectangle(x + 60, y + 120, x + 120, y + 180);
rectangle(x + 120, y + 120, x + 180, y + 180);
brush.color := image7.canvas.brush.color;
rectangle(x, y + 120, x + 60, y + 180);
brush.color := image13.canvas.brush.color;
Pen.color := image13.canvas.brush.color;
Ellipse(x + 61, y + 61, x + 119, y + 119);
Ellipse(x + 2, y + 2, x + 18, y + 18);
Ellipse(x + 122, y + 2, x + 138, y + 18);
Ellipse(x + 2, y + 122, x + 18, y + 138);
Brush.Style := bsclear;
// Die Pencil einträge
font.Size := 12;
font.color := image11.canvas.brush.color;
x := 11;
textout(x + 1, y + 1, '1');
textout(x + 1, y + 21, '4');
textout(x + 1, y + 41, '7');
textout(x + 21, y + 1, '2');
textout(x + 21, y + 21, '5');
textout(x + 21, y + 41, '8');
textout(x + 41, y + 1, '3');
textout(x + 41, y + 21, '6');
textout(x + 41, y + 41, '9');
textout(x + 121, y + 1, '1');
textout(x + 121, y + 21, '4');
textout(x + 121, y + 41, '7');
textout(x + 141, y + 1, '2');
textout(x + 141, y + 21, '5');
textout(x + 141, y + 41, '8');
textout(x + 161, y + 21, '6');
textout(x + 161, y + 41, '9');
Font.color := image12.canvas.brush.color;
textout(x + 1, y + 81, '4');
textout(x + 1, y + 101, '7');
textout(x + 1, y + 121, '1');
textout(x + 1, y + 141, '4');
textout(x + 1, y + 161, '7');
textout(x + 21, y + 61, '2');
textout(x + 21, y + 81, '5');
textout(x + 21, y + 101, '8');
textout(x + 21, y + 141, '5');
textout(x + 21, y + 161, '8');
textout(x + 41, y + 81, '6');
textout(x + 41, y + 101, '9');
textout(x + 41, y + 121, '3');
textout(x + 41, y + 141, '6');
textout(x + 41, y + 161, '9');
textout(x + 61, y + 21, '4');
textout(x + 61, y + 41, '7');
textout(x + 81, y + 21, '5');
textout(x + 81, y + 41, '8');
textout(x + 101, y + 1, '3');
textout(x + 101, y + 21, '6');
textout(x + 101, y + 41, '9');
textout(x + 121, y + 141, '4');
textout(x + 121, y + 161, '7');
textout(x + 141, y + 141, '5');
textout(x + 141, y + 161, '8');
textout(x + 161, y + 141, '6');
textout(x + 161, y + 161, '9');
// Die Feld nummern
x := 6;
font.size := 30;
font.Color := image10.canvas.brush.color;
textout(x + 80, y + 66, '1');
font.Color := image4.canvas.brush.color;
textout(x + 140, y + 66, '3');
font.Color := image8.canvas.brush.color;
textout(x + 80, y + 126, '2');
End;
End;
End;
Procedure TForm2.Button1Click(Sender: TObject);
Var
x: integer;
Begin
// Übernehmen der Farben in die Variablen der Form1
Bretthintergrundfarbe1 := Form2.image2.canvas.brush.color;
Bretthintergrundfarbe2 := Form2.image3.canvas.brush.color;
Maybeedcolor := Form2.image4.canvas.brush.color;
MarkedColor1 := Form2.image5.canvas.brush.color;
MarkedColor2 := Form2.image6.canvas.brush.color;
CursorMarker := Form2.image7.canvas.brush.color;
Fixedcolor := Form2.image8.canvas.brush.color;
Gitterfarbe := Form2.image9.canvas.brush.color;
FontColor := Form2.image10.canvas.brush.color;
Pencilcolor := Form2.image11.canvas.brush.color;
PencilcolorMarked := Form2.image12.canvas.brush.color;
LightenColor := Form2.image13.canvas.brush.color;
FormBackground := Form2.image14.canvas.brush.color;
// Sonderfall Hintergrund = Schwarz
For x := 1 To 6 Do Begin
TCheckbox(Form1.findcomponent('Checkbox' + inttostr(x))).color := FormBackground;
If FormBackground = clblack Then
TCheckbox(Form1.findcomponent('Checkbox' + inttostr(x))).font.color := clwhite
Else
TCheckbox(Form1.findcomponent('Checkbox' + inttostr(x))).font.color := clblack;
End;
// Neuzeichnen
Drawfield;
// Raus
close;
End;
Procedure TForm2.Button2Click(Sender: TObject);
Begin
close;
End;
Procedure TForm2.Image2Click(Sender: TObject);
Begin
// Auswahl einer Farbe
Colordialog1.color := Timage(Sender).Canvas.brush.color;
If Colordialog1.Execute Then Begin
Timage(Sender).Canvas.brush.color := Colordialog1.color;
Redraw;// Neu Zeichnen des Vorschau fensters
End;
End;
Procedure TForm2.FormPaint(Sender: TObject);
Begin
// neuzeichnen
Redraw;
End;
Procedure TForm2.Button3Click(Sender: TObject);
Begin
// Die Standert Farben
image2.canvas.Brush.color := clbtnface;
image3.canvas.Brush.color := clgray;
image4.canvas.Brush.color := clyellow;
image5.canvas.Brush.color := clBlue;
image6.canvas.Brush.color := clnavy;
image7.canvas.Brush.color := clgreen;
image8.canvas.Brush.color := clblack;
image9.canvas.Brush.color := Clblack;
image10.canvas.Brush.color := $00C08000;
image11.canvas.Brush.color := clmaroon;
image12.canvas.Brush.color := $004080FF;
image13.canvas.Brush.color := CLaqua;
image14.canvas.Brush.color := clbtnface;
redraw;
End;
Procedure TForm2.FormCreate(Sender: TObject);
Begin
Caption := 'Sudoku ver. : ' + ver + ' Color Options';
End;
Zu den Menues:
Ursprünglich habe ich das Sudoku nur für die 3x3 Felder gemacht. Das Programm war Fertig und Gut.
Dann Kam meine Freundin und meinte das es ja voll Toll wäre wenn die Größer und Kleiner sein Könnten. Also habe ich das noch NAchträglich reingebaut.
Das einfachste war dann das erstellen neuer Formulare, für Jede Größe. Ich weis Optimal ist es nicht. Aber ich hatte zu dem Zeitpunkt keine Lust mehr.
Ja Die Checkboxen sind schon so ne Sache. Sudoku war eigentlich das erste Programm das ich nicht für mich sondern für andere Geschrieben habe. Und da muste ich noch einiges an Benutzerfreundlichkeit lernen( bei BAlanced ist das schon deutlich besser ).
Die zusammenhänge sollten aber Trotzdem nicht all zu schwer sein. Mit Pencil numbers sind die Kleinen Zahlen gemeint.
Am Besten du erstellst mal ein Sudoku und machst dann die Option "Show pencil numbers" und "show line pencil numbers" an.
Dann Klickst du auf "auto pencil numbers". Dann sollte der sinn Klar werden. Meine Freundin gibt diese Kleinen ZAhlen immer von hand ein , deswegen die Checkbox "edit pencil numbers" und bei den Line sachen ist das genau das selbe.
Wenn dir das Sudoku gefällt solltest du unbedingt mein Nomino_sudoku ausprobieren. Nachdem ich das sudoku für meine Freundin fertig hatte habe ich das dann für mich geschrieben.
|