Autor Beitrag
Method_Man
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 26.10.04 20:43 
Hi Leute!

Ich habe da von jemanden aus dem Forum, sein Programm bisschen verändert, so dass es zu meinem Zweck dient. Ich hoffe er nimmst mir nicht übel. :oops:

Also ich habe das Lotto-Zahlen Generator Programm mit Sound Ausgabe bisschen verändert.

Ich wollte, dass das Programm Zahlen zeigt und dabei die Zahl sagt.
Habe da bisschen reingemischt und ausprobiert aber tun tut er nicht was ich will.
Hab da gerade so eine Idee grad, ich melde mich mit der Frage sofort wieder.

Sorry für eben.

Wie kann man begrenzen, dass er nur bis zu einer bestimmten Zahl zeigt?

Kann mir da jemand helfen?

ausblenden volle Höhe Delphi-Quelltext
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:
unit uMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ExtCtrls, OleCtrls, ACTIVEVOICEPROJECTLib_TLB;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Bevel1: TBevel;
    Image1: TImage;
    Bevel2: TBevel;
    DirectSS1: TDirectSS;
    SpeedButton1: TSpeedButton;
    Timer: TTimer;
    procedure FormPaint(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure TimerTimer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
    i, k, x: Byte;
  Num: array [1..6] of Byte;

implementation

{$R *.DFM}
{$R hbild.res}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Randomize;
  SpeedButton1Click(Sender);
end;

procedure TForm1.FormPaint(Sender: TObject);
var
  Bmp: TBitmap;
  x, y: Word;

begin
  Bmp := TBitmap.Create;
  try
    Bmp.LoadFromResourceName(HInstance,'LOTTO');
    //Bmp.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'lotto.bmp');
    if (Bmp.Width = 0) or (Bmp.Height = 0) then Exit;
    for x := 0 to ClientWidth div Bmp.Width do
      for y := 0 to ClientHeight div Bmp.Height do
        Canvas.Draw(x * Bmp.Width, y * Bmp.Height, Bmp);
  finally Bmp.Free end;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
for i := 1 to 6 do Num[i] := 0;

  i := 1;
  while i <= 6 do begin
    x := Random(49) + 1;
    for k := 1 to i do if x = Num[k] then x := 0;
    if x = 0 then Continue;
    Num[i] := x;
    Inc(i);
  end;

  repeat 
    k := 1;
    for i := 1 to 6 do if Num[i] > Num[i + 1] then begin
      x := Num[i];
      Num[i] := Num[i + 1];
      Num[i + 1] := x;
      k := 0;
      Continue;
    end;
  until k = 1;

  for i := 1 to 6 do
    TEdit(FindComponent('Edit' + IntToStr(i))).Text := Format('%3d', [Num[i]]);

  Application.ProcessMessages; Sleep(100);
  if Random(10) > 4 then SpeedButton1Click(Sender);
  Timer.Tag := 0;
  Timer.Enabled := True;
end;

procedure TForm1.TimerTimer(Sender: TObject);
begin
  Timer.Tag := Timer.Tag + 1;

  DirectSS1.Speak(TEdit(FindComponent('Edit' + IntToStr(Timer.Tag))).Text);

  if Timer.Tag >= 6 then Timer.Enabled := False;
end;

end.



//Edit


Zuletzt bearbeitet von Method_Man am Mi 27.10.04 21:52, insgesamt 6-mal bearbeitet
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Di 26.10.04 20:55 
hhm... ohne Code wird das hier wohl nicht viel werden.
und Luckie hat seine Glaskugel wahrscheinlich auch wieder verlegt :wink:

mal so ins Nichts: randomize? Zahlenzuweisung?

[edit]
Zitat:
Quelltext folgt, sorry ich habe eine einfachere Lösung gefunden, wo ihr mir nur sehr wenig helfe könnt.
Stand das vorhin auch schon da? oder hast du editiert und er zeigts nicht an?

also können wir dir jetzt nicht mehr helfen oder besteht das Problem trotzdem noch?[edit]

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Method_Man
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 26.10.04 22:20 
//EDIT

Habe es jetzt alleine geschafft.

Aber ich hätte noch eine Frage, wie kann ich es darauf bringen, dass es bei jedem Klick auf Speed Button z.B. 1 dann 2 dann 3 usw. zeigt.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mi 27.10.04 19:38 
mitzählen und variable ausgeben?
wie gesagt ohne code (und da ich nicht wirklich weiß was du willst) wird's nich viel mit Helfen.

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)