Visual Studio 2012 Express Edition ¤ÇForm ¥¢¥×¥ê¤òºî¤í¤¦
£±ÆüÌÜ¡¡
Visual Studio Express for windows Desktop¡¡Visual C++ 2012¤Ë¤Ï¥Õ¥©¡¼¥à¤¬Ìµ¤¤¡£
1.¿·¤·¤¤¥×¥í¥¸¥§¥¯¥È¤òºîÀ®
£²¡¥¶õ¤ÎCLR¥×¥í¥¸¥§¥¯¥ÈºîÀ®
£³¡¥¥×¥í¥¸¥§¥¯¥È¤«¤é¡Ö¿·¤·¤¤¹àÌܤÎÄɲá×
£´¡¥
£µ¡¥¥Õ¥©¡¼¥à¤Ë¥Ü¥¿¥ó¤òÄɲÃ
£¶¡¥£ó£ï£õ£å£ã£å£±¡¥£ã£ð£ð¤Ë¼¡¤òÆþÎÏ
#include "MyForm.h"
using namespace Project1;
[STAThreadAttribute]
/*
ñ°ì¤Î¥¹¥ì¥Ã¥É¤òÁÛÄê¡¢¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¤ÎÂбþ¤·
¥ª¥Ö¥¸¥§¥¯¥È¤ÏSTA(Single-Threaded Apartment)¤«
MTA(Multithreaded Apartment) */
int main(){
Console::SetWindowSize(1,1); //Console ºÇ¾®²½
MyForm ^st=gcnew MyForm();
st->ShowDialog();
return 0;
}
¥³¥ó¥Ñ¥¤¥ë¼Â¹Ô¤ò¤¹¤ë
Îã
#pragma once
static int hai[50];
namespace Project2 {
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>
/// MyForm ¤Î³µÍ×
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: ¤³¤³¤Ë¥³¥ó¥¹¥È¥é¥¯¥¿¡¼ ¥³¡¼¥É¤òÄɲä·¤Þ¤¹
//
}
protected:
/// <summary>
/// »ÈÍÑÃæ¤Î¥ê¥½¡¼¥¹¤ò¤¹¤Ù¤Æ¥¯¥ê¡¼¥ó¥¢¥Ã¥×¤·¤Þ¤¹¡£
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private:
/// <summary>
/// ɬÍפʥǥ¶¥¤¥Ê¡¼ÊÑ¿ô¤Ç¤¹¡£
/// </summary>
System::ComponentModel::Container ^components;
public:
array<Bitmap^>^ bmpdata;
void DispHai( int nohai,int xx){
Graphics^ gr=this->CreateGraphics();
int X0=10,Y0=1;
//Pen^ pen1=gcnew Pen(col);
//¸¶²èÁü¤òº¸¾å¤ËÉÁ²è¤¹¤ë
if(xx==1){
Bitmap^ bmap1; //bmap1¤Î³ÎÊÝ
bmap1=bmpdata[nohai];
gr->DrawImage(bmap1,X0,Y0);
}
}
#pragma region Windows Form Designer generated code
/// <summary>
/// ¥Ç¥¶¥¤¥Ê¡¼ ¥µ¥Ý¡¼¥È¤ËɬÍפʥ᥽¥Ã¥É¤Ç¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤ÎÆâÍƤò
/// ¥³¡¼¥É ¥¨¥Ç¥£¥¿¡¼¤ÇÊѹ¹¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(127, 198);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 261);
this->Controls->Add(this->button1);
this->Name = L"MyForm";
this->Text = L"MyForm";
this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &MyForm::MyForm_Paint);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void MyForm_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
DispHai( 1,1);
}
private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
// array<Bitmap^>^ bmpdata = gcnew array<Bitmap^ >(50);
bmpdata = gcnew array<Bitmap^ >(50);
String^ filename;
int no;
for(no=1;no<10;no++){
filename="c:\\card\\pz"+no+".bmp" ;
bmpdata[no]=gcnew Bitmap(filename);
}
for(no=11;no<20;no++){
filename="c:\\card\\sz"+(no-10)+".bmp" ;
bmpdata[no]=gcnew Bitmap(filename);
}
for(no=21;no<30;no++){
filename="c:\\card\\wz"+(no-20)+".bmp" ;
bmpdata[no]=gcnew Bitmap(filename);
}
for(no=31;no<35;no++){
filename="c:\\card\\kz"+(no-30)+".bmp" ;
bmpdata[no]=gcnew Bitmap(filename);
}
for(no=35;no<38;no++){
filename="c:\\card\\sg"+(no-34)+".bmp" ;
bmpdata[no]=gcnew Bitmap(filename);
}
}
};
}