Visual Studio 2010 Express Edition ¤Ç¿À·Ð¿ê¼å¥²¡¼¥à¤òºî¤í¤¦
¥Þ¥¦¥¹¤Î°ÌÃÖ¤ò¤òÆÉ¤ß¼è¤ë
¥Þ¥¦¥¹¤Î½àÈ÷
private: System::Void Form1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
int mx1=e->X;
int my1=e->Y;
int X0,Y0;
int x;
for(x=1;x<=13;x++){
X0=80*x;
Y0=100;
//ÆÉ¤ß¼è¤ëÈϰϤò»ØÄê
if(mx1>X0 && mx1<X0+80 && my1>Y0 && my1<Y0+100){
if(e->Button==System::Windows::Forms::MouseButtons::Left)
mx1d=x;¡¡//º¸¥¯¥ê¥Ã¥¯
crcm++;
if(e->Button==System::Windows::Forms::MouseButtons::Right)
mx1d=0;¡¡//±¦¥¯¥ê¥Ã¥¯
textBox2->Text=Convert::ToString(x);
}
}
ÀÖ»ú¤¬ÆþÎÏ
#pragma once
namespace test4 {
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>
/// Form1 ¤Î³µÍ×
///
/// ·Ù¹ð: ¤³¤Î¥¯¥é¥¹¤Î̾Á°¤òÊѹ¹¤¹¤ë¾ì¹ç¡¢¤³¤Î¥¯¥é¥¹¤¬°Í¸¤¹¤ë¤¹¤Ù¤Æ¤Î .resx ¥Õ¥¡¥¤¥ë¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿
/// ¥Þ¥Í¡¼¥¸ ¥ê¥½¡¼¥¹ ¥³¥ó¥Ñ¥¤¥é ¥Ä¡¼¥ë¤ËÂФ·¤Æ 'Resource File Name' ¥×¥í¥Ñ¥Æ¥£¤ò
/// Êѹ¹¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¤³¤ÎÊѹ¹¤ò¹Ô¤ï¤Ê¤¤¤È¡¢
/// ¥Ç¥¶¥¤¥Ê¤È¡¢¤³¤Î¥Õ¥©¡¼¥à¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥í¡¼¥«¥é¥¤¥ººÑ¤ß¥ê¥½¡¼¥¹¤È¤¬¡¢
/// Àµ¤·¤¯Áê¸ß¤ËÍøÍѤǤ¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: ¤³¤³¤Ë¥³¥ó¥¹¥È¥é¥¯¥¿ ¥³¡¼¥É¤òÄɲä·¤Þ¤¹
//
}
protected:
/// <summary>
/// »ÈÍÑÃæ¤Î¥ê¥½¡¼¥¹¤ò¤¹¤Ù¤Æ¥¯¥ê¡¼¥ó¥¢¥Ã¥×¤·¤Þ¤¹¡£
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::TextBox^ textBox1;
private:
/// <summary>
/// ɬÍפʥǥ¶¥¤¥ÊÊÑ¿ô¤Ç¤¹¡£
/// </summary>
System::ComponentModel::Container ^components;
//--------------------
public: static array <int>^ noh =gcnew array<int>(14);
public: static array <int>^ nos =gcnew array<int>(14);
public: static array <int>^ nou1 =gcnew array<int>(14);
public: static array <int>^ nou2 =gcnew array<int>(14);
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::TextBox^ textBox3;
public:
public: static int no;
public: static int mx1,my1;
public: static int mx1d,my1d,mold,flag1,crc,crcm;
private: System::Windows::Forms::TextBox^ textBox4;
public:
//--------------------
#pragma region Windows Form Designer generated code
/// <summary>
/// ¥Ç¥¶¥¤¥Ê ¥µ¥Ý¡¼¥È¤ËɬÍפʥ᥽¥Ã¥É¤Ç¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤ÎÆâÍÆ¤ò
/// ¥³¡¼¥É ¥¨¥Ç¥£¥¿¤ÇÊѹ¹¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(259, 28);
this->button1->Margin = System::Windows::Forms::Padding(4, 4, 4, 4);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(139, 42);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(76, 15);
this->textBox1->Margin = System::Windows::Forms::Padding(4, 4, 4, 4);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(157, 22);
this->textBox1->TabIndex = 1;
//
// button2
//
this->button2->Location = System::Drawing::Point(425, 32);
this->button2->Margin = System::Windows::Forms::Padding(4, 4, 4, 4);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(140, 38);
this->button2->TabIndex = 2;
this->button2->Text = L"button2";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(79, 52);
this->textBox2->Margin = System::Windows::Forms::Padding(4, 4, 4, 4);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(153, 22);
this->textBox2->TabIndex = 3;
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(77, 90);
this->textBox3->Margin = System::Windows::Forms::Padding(4, 4, 4, 4);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(153, 22);
this->textBox3->TabIndex = 4;
//
// textBox4
//
this->textBox4->Location = System::Drawing::Point(625, 48);
this->textBox4->Margin = System::Windows::Forms::Padding(4, 4, 4, 4);
this->textBox4->Name = L"textBox4";
this->textBox4->Size = System::Drawing::Size(208, 22);
this->textBox4->TabIndex = 5;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 15);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(1152, 535);
this->Controls->Add(this->textBox4);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->button2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button1);
this->Margin = System::Windows::Forms::Padding(4, 4, 4, 4);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::Form1_Paint);
this->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Form1_MouseDown);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
Graphics^ g=this->CreateGraphics();
Bitmap^ bmap1;
String^ filename;
int x;
for(x=1;x<=13;x++){
no=noh[x];
if(no==0) no=1;
filename="c:\\card\\"+no+"_he.gif";
if(nou1[x]==100) filename="c:\\card\\0_r1.gif";
bmap1=gcnew Bitmap(filename);
if(x<=crc) g->DrawImage(bmap1,80*x,100);
no=nos[x];
if(no==0) no=1;
filename="c:\\card\\"+no+"_sp.gif";
if(nou2[x]==100) filename="c:\\card\\0_r1.gif";
bmap1=gcnew Bitmap(filename);
if(x<=crc) g->DrawImage(bmap1,80*x,220);
}
//textBox2->Text=Convert::ToString(xx);
//textBox3->Text=Convert::ToString(yy);
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if(flag1==0){
flag1=1;
crcm=0;
crc++;
if (crc==13) crc=13;
int x,d,y,flag;
for(x=1;x<=13;x++) {
noh[x]=0;
nos[x]=0;
nou1[x]=0;
nou2[x]=0;
}
x=1;
do { d=(rand()%crc)+1;
flag=0;
for(y=1;y<=crc;y++) if(noh[y]==d) flag=1;
if(flag==0) { noh[x]=d;
x++; }
} while(x<=crc);
x=1;
do { d=(rand()%crc)+1;
flag=0;
for(y=1;y<=crc;y++) if(nos[y]==d) flag=1;
if(flag==0) { nos[x]=d;
x++; }
} while(x<=crc);
textBox1->Text=Convert::ToString(no);
Invalidate();
}
flag1=0;
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
mx1d=0;
my1d=0;
flag1=0;
crc=2;
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
int x;
for(x=1;x<=13;x++){
nou1[x]=100;
nou2[x]=100;
}
Invalidate();
}
private: System::Void Form1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
int mx1=e->X;
int my1=e->Y;
int X0,Y0;
int x;
if(crcm>crc*2) {textBox4->Text="ºÆÄ©Àï";
for(x=1;x<=13;x++){
nou1[x]=100;
nou2[x]=100;
}
Invalidate();
crcm=0;
}
for(x=1;x<=13;x++){
X0=80*x;
Y0=100;
if(mx1>X0 && mx1<X0+80 && my1>Y0 && my1<Y0+100){
if(e->Button==System::Windows::Forms::MouseButtons::Left)
mx1d=x;
crcm++;
if(e->Button==System::Windows::Forms::MouseButtons::Right)
mx1d=0;
textBox2->Text=Convert::ToString(x);
}
}
for(x=1;x<=13;x++){
X0=80*x;
Y0=200;
if(mx1>X0 && mx1<X0+80 && my1>Y0 && my1<Y0+100){
if(e->Button==System::Windows::Forms::MouseButtons::Left)
my1d=x;
crcm++;
if(e->Button==System::Windows::Forms::MouseButtons::Right)
mx1d=0;
textBox3->Text=Convert::ToString(x);
}
}
if ( noh[mx1d]==nos[my1d]) {textBox1->Text="Ʊ¤¸";
nou1[mx1d]=noh[mx1d];
nou2[my1d]=nos[my1d];
if(crc*2==crcm) textBox4->Text="¹ç³Ê";
}
else textBox1->Text="°Û¤Ê¤ë";
//mold=noh[mx1d];
Invalidate();
}
};
}
¼Â¹Ô¡¡¥½¡¼¥¹¡¡»²¾È¡¡¥×¥í¥°¥é¥à¥À¥¦¥ó¥í¡¼¥É
test4
c:\card ɬÍ×