Thema: Delphi Millionenshow

Einzelnen Beitrag anzeigen

Wolfning

Registriert seit: 8. Nov 2004
8 Beiträge
 
#13

Re: Millionenshow

  Alt 8. Nov 2004, 15:38
hier habt ihr meinen Code:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Menus;

type
  TForm1 = class(TForm)
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    Button1: TButton;
    Memo1: TMemo;
    Label1: TLabel;
    MainMenu1: TMainMenu;
    Datei1: TMenuItem;
    ffnen1: TMenuItem;
    Beenden1: TMenuItem;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    
    procedure Beenden1Click(Sender: TObject);
    procedure ffnen1Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

var qn,i : integer;

procedure TForm1.Button1Click(Sender: TObject);
var eingabe, richtig:string;
begin

richtig:=memo1.Lines[qn+5];


If form1.radiobutton1.checked = true then eingabe := '1';
If form1.radiobutton2.checked = true then eingabe := '2';
If form1.radiobutton3.checked = true then eingabe := '3';
If form1.radiobutton4.checked = true then eingabe := '4';

If richtig = eingabe then
 begin
 i:=i+1;
 qn:= qn+6;
 form1.radiobutton1.checked:= false;
 form1.radiobutton2.checked:= false;
 form1.radiobutton3.checked:= false;
 form1.radiobutton4.checked:= false;
 form1.label1.caption:=memo1.Lines[qn];

 form1.radiobutton1.caption:= memo1.Lines[qn+1];
 form1.radiobutton2.caption:= memo1.Lines[qn+2];
 form1.radiobutton3.caption:= memo1.Lines[qn+3];
 form1.radiobutton4.caption:= memo1.Lines[qn+4];
 richtig:=memo1.Lines[qn+6];
 IF form1.memo1.Lines[qn] = 'then form1.Label1.Caption:= 'ENDE';
 end
 else
 begin
 form1.label1.caption:= 'falsch!!!!!';
 form1.label2.caption:= 'Richtige Antworten: '+ inttostr(i);
 form1.RadioButton1.Visible:=false;
 form1.RadioButton2.Visible:=false;
 form1.RadioButton3.Visible:=false;
 form1.RadioButton4.Visible:=false;
 form1.Button1.Visible:=false;
 end;

end;


procedure TForm1.Beenden1Click(Sender: TObject);
begin
close;
end;

procedure TForm1.ffnen1Click(Sender: TObject);
begin
Form1.Button1.visible:= true;
qn:= 0;

form1.label2.caption:='';
form1.RadioButton1.Visible:=true;
form1.RadioButton2.Visible:=true;
form1.RadioButton3.Visible:=true;
form1.RadioButton4.Visible:=true;
form1.Label1.Visible:=true;
form1.Button1.Visible:=true;

form1.Memo1.lines.LoadFromFile('questions.txt');
form1.label1.caption:= memo1.Lines[qn+0];
form1.radiobutton1.caption:= memo1.Lines[qn+1];
form1.radiobutton2.caption:= memo1.Lines[qn+2];
form1.radiobutton3.caption:= memo1.Lines[qn+3];
form1.radiobutton4.caption:= memo1.Lines[qn+4];


end;



end.
  Mit Zitat antworten Zitat