blikk info infothek forum galerie sitemap

Tic Tac Toe Pro Version Teil 1

zur Aufgabenstellung

using System;

using System.Windows.Forms;//sind die kompletten Formen Buttons...

using System.Drawing;// wird gebraucht um Farben bei Ausgabe zu sehen

using System.ComponentModel; //das sind die komponenten der Modelle

 

 

namespace TicTacToe

{

    public class Form1 : Form //1 Klasse im Programm

    {

        private Label überschrift; //Deklarierung der Felder/Buttons etc...

        private Button feld1;

        private Button feld2;

        private Button feld3;

        private Button feld4;

        private Button feld5;

        private Button feld6;

        private Button feld7;

        private Button feld8;

        private Button feld9;

        private Button play;

 

        private Button[] buttonarray;   // Deklarierung des Buttonarrays

        private bool spieler;            // damit wird entschieden welcher Char X oder O

        private bool gv;                // das spiel ist vorbei

        private Button about;

        private Button button1;   

 

        /// <summary>

        /// Required designer variable.

        /// </summary>

        private Container components = null;

 

        public Form1()

        {

            //

            // Wird für den Designer support gebraucht

            //

            InitializeComponent();

            //

            //

            //

        }

 

        /// <summary>

        /// Clean up any resources being used.

        /// </summary>

        protected override void Dispose(bool disposing)

        {

            if (disposing)

            {

                if (components != null)

                {

                    components.Dispose();

                }

            }

            base.Dispose(disposing);

        }

 

        #region Windows Form Designer generated code

        /// <summary>

        /// Required method for Designer support - do not modify

        /// the contents of this method with the code editor.

        /// </summary>

        private void InitializeComponent()

        {

            ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));

            this.überschrift = new Label(); //Die sog. Initialisierung der Felder/Buttons... etc

            this.feld1 = new Button();

            this.feld2 = new Button();

            this.feld3 = new Button();

            this.feld4 = new Button();

            this.feld5 = new Button();

            this.feld6 = new Button();

            this.feld7 = new Button();

            this.feld8 = new Button();

            this.feld9 = new Button();

            this.play = new Button();

            this.about = new Button();

            this.button1 = new Button();

            this.SuspendLayout();

            //

            // Überschrift - Überschrift - Formatierung...

            //

            this.überschrift.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.überschrift.Location = new System.Drawing.Point(44, 9);

            this.überschrift.Name = "überschrift";

            this.überschrift.Size = new System.Drawing.Size(230, 20);

            this.überschrift.TabIndex = 10;

            this.überschrift.Text = "Willkommen bei Tic Tac Toe";

            //

            // Feld1 - Überschrift - Formatierung...

            //

            this.feld1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld1.Location = new System.Drawing.Point(25, 54); //Koordinaten für Ort des Buttons

            this.feld1.Name = "feld1"; //Name des Buttons

            this.feld1.Size = new System.Drawing.Size(85, 85); //Größe des Buttons

            this.feld1.TabIndex = 0; // Indexnummer des Buttons

            this.feld1.UseVisualStyleBackColor = true; //Übernahme von Form1 auf Buttons

            //

            // feld2

            //

            this.feld2.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld2.Location = new System.Drawing.Point(116, 54);

            this.feld2.Name = "feld2";

            this.feld2.Size = new System.Drawing.Size(85, 85);

            this.feld2.TabIndex = 1;

            this.feld2.UseVisualStyleBackColor = true;

            //

            // feld3

            //

            this.feld3.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld3.Location = new System.Drawing.Point(207, 54);

            this.feld3.Name = "feld3";

            this.feld3.Size = new System.Drawing.Size(85, 85);

            this.feld3.TabIndex = 2;

            this.feld3.UseVisualStyleBackColor = true;

            //

            // feld4

            //

            this.feld4.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld4.Location = new System.Drawing.Point(25, 145);

            this.feld4.Name = "feld4";

            this.feld4.Size = new System.Drawing.Size(85, 85);

            this.feld4.TabIndex = 3;

            this.feld4.UseVisualStyleBackColor = true;

            //

            // feld5

            //

            this.feld5.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld5.Location = new System.Drawing.Point(116, 145);

            this.feld5.Name = "feld5";

            this.feld5.Size = new System.Drawing.Size(85, 85);

            this.feld5.TabIndex = 4;

            this.feld5.UseVisualStyleBackColor = true;

            //

            // feld6

            //

            this.feld6.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld6.Location = new System.Drawing.Point(207, 145);

            this.feld6.Name = "feld6";

            this.feld6.Size = new System.Drawing.Size(85, 85);

            this.feld6.TabIndex = 5;

            this.feld6.UseVisualStyleBackColor = true;

            //

            // feld7

            //

            this.feld7.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld7.Location = new System.Drawing.Point(25, 236);

            this.feld7.Name = "feld7";

            this.feld7.Size = new System.Drawing.Size(85, 85);

            this.feld7.TabIndex = 6;

            this.feld7.UseVisualStyleBackColor = true;

            //

            // feld8

            //

            this.feld8.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            this.feld8.Location = new System.Drawing.Point(116, 236);

            this.feld8.Name = "feld8";

            this.feld8.Size = new System.Drawing.Size(85, 85);

            this.feld8.TabIndex = 7;

            this.feld8.UseVisualStyleBackColor = true;

 

nach oben
punkt   seitenbereich schließen

Links

Zu Teil 2