Dastur kodi
Source.cpp
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThread]
void main(array^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
xoxo::MyForm form;
Application::Run(% form);
}
MyForm.h
#pragma once
namespace xoxo {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Сводка для MyForm
///
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: добавьте код конструктора
//
}
protected:
///
/// Освободить все используемые ресурсы.
///
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::TextBox^ textBox6;
private: System::Windows::Forms::TextBox^ textBox5;
private: System::Windows::Forms::TextBox^ textBox4;
private: System::Windows::Forms::TextBox^ textBox9;
private: System::Windows::Forms::TextBox^ textBox8;
private: System::Windows::Forms::TextBox^ textBox7;
private:
///
/// Обязательная переменная конструктора.
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
///
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->textBox6 = (gcnew System::Windows::Forms::TextBox());
this->textBox5 = (gcnew System::Windows::Forms::TextBox());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->textBox9 = (gcnew System::Windows::Forms::TextBox());
this->textBox8 = (gcnew System::Windows::Forms::TextBox());
this->textBox7 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label1->Location = System::Drawing::Point(116, 63);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(129, 24);
this->label1->TabIndex = 0;
this->label1->Text = L"X va O o\'yini";
//
// textBox1
//
this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox1->Location = System::Drawing::Point(98, 100);
this->textBox1->Multiline = true;
this->textBox1->Name = L"textBox1";
this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox1->Size = System::Drawing::Size(58, 59);
this->textBox1->TabIndex = 1;
this->textBox1->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox1->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox2
//
this->textBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox2->Location = System::Drawing::Point(153, 100);
this->textBox2->Multiline = true;
this->textBox2->Name = L"textBox2";
this->textBox2->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox2->Size = System::Drawing::Size(58, 59);
this->textBox2->TabIndex = 2;
this->textBox2->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox2->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox3
//
this->textBox3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox3->Location = System::Drawing::Point(206, 100);
this->textBox3->Multiline = true;
this->textBox3->Name = L"textBox3";
this->textBox3->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox3->Size = System::Drawing::Size(58, 59);
this->textBox3->TabIndex = 3;
this->textBox3->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox3->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox6
//
this->textBox6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox6->Location = System::Drawing::Point(206, 155);
this->textBox6->Multiline = true;
this->textBox6->Name = L"textBox6";
this->textBox6->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox6->Size = System::Drawing::Size(58, 59);
this->textBox6->TabIndex = 6;
this->textBox6->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox6->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox5
//
this->textBox5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox5->Location = System::Drawing::Point(153, 155);
this->textBox5->Multiline = true;
this->textBox5->Name = L"textBox5";
this->textBox5->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox5->Size = System::Drawing::Size(58, 59);
this->textBox5->TabIndex = 5;
this->textBox5->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox5->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox4
//
this->textBox4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox4->Location = System::Drawing::Point(98, 155);
this->textBox4->Multiline = true;
this->textBox4->Name = L"textBox4";
this->textBox4->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox4->Size = System::Drawing::Size(58, 59);
this->textBox4->TabIndex = 4;
this->textBox4->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox4->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox9
//
this->textBox9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox9->Location = System::Drawing::Point(206, 209);
this->textBox9->Multiline = true;
this->textBox9->Name = L"textBox9";
this->textBox9->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox9->Size = System::Drawing::Size(58, 59);
this->textBox9->TabIndex = 9;
this->textBox9->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox9->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox8
//
this->textBox8->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox8->Location = System::Drawing::Point(153, 209);
this->textBox8->Multiline = true;
this->textBox8->Name = L"textBox8";
this->textBox8->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox8->Size = System::Drawing::Size(58, 59);
this->textBox8->TabIndex = 8;
this->textBox8->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox8->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// textBox7
//
this->textBox7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox7->Location = System::Drawing::Point(98, 209);
this->textBox7->Multiline = true;
this->textBox7->Name = L"textBox7";
this->textBox7->ScrollBars = System::Windows::Forms::ScrollBars::Horizontal;
this->textBox7->Size = System::Drawing::Size(58, 59);
this->textBox7->TabIndex = 7;
this->textBox7->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
this->textBox7->Click += gcnew System::EventHandler(this, &MyForm::btnClick);
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(192)), static_cast(static_cast(255)),
static_cast(static_cast(192)));
this->ClientSize = System::Drawing::Size(356, 360);
this->Controls->Add(this->textBox9);
this->Controls->Add(this->textBox8);
this->Controls->Add(this->textBox7);
this->Controls->Add(this->textBox6);
this->Controls->Add(this->textBox5);
this->Controls->Add(this->textBox4);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label1);
this->Name = L"MyForm";
this->Text = L"MyForm";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void btnClick(System::Object^ sender, System::EventArgs^ e) {
if (textBox1->Text == "x" && textBox2->Text == "x" && textBox3->Text == "x" ||
textBox1->Text == "x" && textBox5->Text == "x" && textBox9->Text == "x" ||
textBox1->Text == "x" && textBox4->Text == "x" && textBox7->Text == "x" ||
textBox3->Text == "x" && textBox5->Text == "x" && textBox7->Text == "x" ||
textBox3->Text == "x" && textBox6->Text == "x" && textBox9->Text == "x" ||
textBox4->Text == "x" && textBox5->Text == "x" && textBox6->Text == "x" ||
textBox7->Text == "x" && textBox8->Text == "x" && textBox9->Text == "x")
{
label1->ForeColor = System::Drawing::Color::Red;
label1->Text = "X o'yinchi yutdi";
textBox1->ReadOnly = true;
textBox2->ReadOnly = true;
textBox3->ReadOnly = true;
textBox4->ReadOnly = true;
textBox5->ReadOnly = true;
textBox6->ReadOnly = true;
textBox7->ReadOnly = true;
textBox8->ReadOnly = true;
textBox9->ReadOnly = true;
}
else if(textBox1->Text == "o" && textBox2->Text == "o" && textBox3->Text == "o" ||
textBox1->Text == "o" && textBox5->Text == "o" && textBox9->Text == "o" ||
textBox1->Text == "o" && textBox4->Text == "o" && textBox7->Text == "o" ||
textBox3->Text == "o" && textBox5->Text == "o" && textBox7->Text == "o" ||
textBox3->Text == "o" && textBox6->Text == "o" && textBox9->Text == "o" ||
textBox4->Text == "o" && textBox5->Text == "o" && textBox6->Text == "o" ||
textBox7->Text == "o" && textBox8->Text == "o" && textBox9->Text == "o" )
{
label1->ForeColor = System::Drawing::Color::Red;
label1->Text = "O o'yinchi yutdi";
textBox1->ReadOnly = true;
textBox2->ReadOnly = true;
textBox3->ReadOnly = true;
textBox4->ReadOnly = true;
textBox5->ReadOnly = true;
textBox6->ReadOnly = true;
textBox7->ReadOnly = true;
textBox8->ReadOnly = true;
textBox9->ReadOnly = true;
}
else
{
label1->ForeColor = System::Drawing::Color::Red;
label1->Text = "Durrang";
}
}
};
}
Do'stlaringiz bilan baham: |