QUIZ

Layout:

Sourcecode:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace quiz
{

/// <summary>
/// Zusammenfassung für Form1.
/// </summary>

public class Form1 : System.Windows.Forms.Form
{

private System.Windows.Forms.Button btn_End;
private System.Windows.Forms.GroupBox grp_Frage;
private System.Windows.Forms.RadioButton rad_roem;
private System.Windows.Forms.RadioButton rad_heiz;
private System.Windows.Forms.RadioButton rad_ger;
private System.Windows.Forms.Button btn_loes;

/// <summary>
/// Erforderliche Designervariable.
/// </summary>

private System.ComponentModel.Container components = null;

public Form1()
{

//
// Erforderlich für die Windows Form-Designerunterstützung
//

InitializeComponent();

//
// TODO: Fügen Sie den Konstruktorcode nach dem Aufruf von InitializeComponent hinzu
//

}

/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>

protected override void Dispose( bool disposing )
{

if( disposing )
{

if (components != null)
{

components.Dispose();

}

}
base.Dispose( disposing );

}

#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>

private void InitializeComponent()
{

this.btn_End = new System.Windows.Forms.Button();
this.grp_Frage = new System.Windows.Forms.GroupBox();
this.rad_roem = new System.Windows.Forms.RadioButton();
this.rad_heiz = new System.Windows.Forms.RadioButton();
this.rad_ger = new System.Windows.Forms.RadioButton();
this.btn_loes = new System.Windows.Forms.Button();
this.grp_Frage.SuspendLayout();
this.SuspendLayout();

//
// btn_End
//

this.btn_End.Location = new System.Drawing.Point(360, 200);
this.btn_End.Name = "btn_End";
this.btn_End.Size = new System.Drawing.Size(144, 40);
this.btn_End.TabIndex = 4;
this.btn_End.Text = "Ende";
this.btn_End.Click += new System.EventHandler(this.btn_End_Click);

//
// grp_Frage
//

this.grp_Frage.Controls.Add(this.rad_ger);
this.grp_Frage.Controls.Add(this.rad_heiz);
this.grp_Frage.Controls.Add(this.rad_roem);
this.grp_Frage.Location = new System.Drawing.Point(40, 24);
this.grp_Frage.Name = "grp_Frage";
this.grp_Frage.Size = new System.Drawing.Size(232, 160);
this.grp_Frage.TabIndex = 1;
this.grp_Frage.TabStop = false;
this.grp_Frage.Text = "Ein Radiator ist";

//
// rad_roem
//

this.rad_roem.Location = new System.Drawing.Point(48, 24);
this.rad_roem.Name = "rad_roem";
this.rad_roem.Size = new System.Drawing.Size(144, 32);
this.rad_roem.TabIndex = 2;
this.rad_roem.TabStop = true;
this.rad_roem.Text = "ein römischer Schaukämpfer";

//
// rad_heiz
//

this.rad_heiz.Location = new System.Drawing.Point(48, 72);
this.rad_heiz.Name = "rad_heiz";
this.rad_heiz.Size = new System.Drawing.Size(144, 32);
this.rad_heiz.TabIndex = 1;
this.rad_heiz.TabStop = true;
this.rad_heiz.Text = "ein Heizkörper";

//
// rad_ger
//

this.rad_ger.Location = new System.Drawing.Point(48, 120);
this.rad_ger.Name = "rad_ger";
this.rad_ger.Size = new System.Drawing.Size(144, 32);
this.rad_ger.TabIndex = 0;
this.rad_ger.TabStop = true;
this.rad_ger.Text = "ein Gerät zum Messen des Kreisradius";

//
// btn_loes
//

this.btn_loes.Location = new System.Drawing.Point(360, 144);
this.btn_loes.Name = "btn_loes";
this.btn_loes.Size = new System.Drawing.Size(144, 40);
this.btn_loes.TabIndex = 3;
this.btn_loes.Text = "Lösung";
this.btn_loes.Click += new System.EventHandler(this.btn_loes_Click);

//
// Form1
//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(520, 301);
this.Controls.Add(this.btn_loes);
this.Controls.Add(this.grp_Frage);
this.Controls.Add(this.btn_End);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Quiz";
this.Load += new System.EventHandler(this.Form1_Load);
this.grp_Frage.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>

[STAThread]
static void Main()
{

Application.Run(new Form1());

}

private void btn_End_Click(object sender, System.EventArgs e)
{

this.Close();

}

private void Form1_Load(object sender, System.EventArgs e)
{

rad_ger.Checked=true;

}

private void btn_loes_Click(object sender, System.EventArgs e)
{

if(rad_heiz.Checked)
{

MessageBox.Show("SUUUUUUUPER!!!");

}
else
{

MessageBox.Show("OJEEEEEEEEEE!!!");

}

}

}

}

<<zurück>>