
#pragma once
namespace My39 {
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^ BtnMoveButton;
protected:
private: System::Windows::Forms::Label^ lblHelp;
private: System::Windows::Forms::Timer^ t;
private: System::ComponentModel::IContainer^ components;
private:
///
/// Required designer variable.
///
#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->components = (gcnew System::ComponentModel::Container());
this->BtnMoveButton = (gcnew System::Windows::Forms::Button());
this->lblHelp = (gcnew System::Windows::Forms::Label());
this->t = (gcnew System::Windows::Forms::Timer(this->components));
this->SuspendLayout();
//
// BtnMoveButton
//
this->BtnMoveButton->Location = System::Drawing::Point(96, 63);
this->BtnMoveButton->Name = L"BtnMoveButton";
this->BtnMoveButton->Size = System::Drawing::Size(98, 16);
this->BtnMoveButton->TabIndex = 0;
this->BtnMoveButton->Text = L"...";
this->BtnMoveButton->UseVisualStyleBackColor = true;
this->BtnMoveButton->Click += gcnew System::EventHandler(this, &Form1::BtnMoveButton_Click);
//
// lblHelp
//
this->lblHelp->AutoSize = true;
this->lblHelp->Location = System::Drawing::Point(93, 25);
this->lblHelp->Name = L"lblHelp";
this->lblHelp->Size = System::Drawing::Size(101, 13);
this->lblHelp->TabIndex = 1;
this->lblHelp->Text = L"Click Button to Start";
//
// t
//
this->t->Interval = 1;
this->t->Tick += gcnew System::EventHandler(this, &Form1::t_Tick);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 95);
this->Controls->Add(this->lblHelp);
this->Controls->Add(this->BtnMoveButton);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
//Move Button
private: System::Void BtnMoveButton_Click(System::Object^ sender, System::EventArgs^ e) {
t->Enabled=true;
t->Interval=10;
}
private: System::Void t_Tick(System::Object^ sender, System::EventArgs^ e) {
BtnMoveButton->Left=BtnMoveButton->Left+1;
if(BtnMoveButton->Left>=this->Width)
{
BtnMoveButton->Left=0;
}
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
this->Text="Move Button";
this->BackColor=Color::Aquamarine;
this->MaximizeBox=false;
}
};
}