
#pragma once
namespace My26 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
///
/// Clean up any resources being used.
///
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ BtnRandom;
protected:
protected:
private:
///
/// Required designer variable.
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
this->BtnRandom = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// BtnRandom
//
this->BtnRandom->Location = System::Drawing::Point(31, 22);
this->BtnRandom->Name = L"BtnRandom";
this->BtnRandom->Size = System::Drawing::Size(190, 56);
this->BtnRandom->TabIndex = 0;
this->BtnRandom->Text = L"Random";
this->BtnRandom->UseVisualStyleBackColor = true;
this->BtnRandom->Click += gcnew System::EventHandler(this, &Form1::BtnRandom_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(237, 98);
this->Controls->Add(this->BtnRandom);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
//Random
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
this->BackColor=Color::BlueViolet;
this->MaximizeBox=false;
this->Text="Random : ";
BtnRandom->BackColor=Color::Black;
BtnRandom->ForeColor=Color::White;
}
private: System::Void BtnRandom_Click(System::Object^ sender, System::EventArgs^ e) {
int i;
i=Random().Next(100);
this->Text="Random : "+i.ToString();
}
};
}