#using <mscorlib.dll> // 这是使用应用程序向导生成的 VC++(www.cppentry.com) // 应用程序项目的主项目文件。 // This is the main project file for VC++(www.cppentry.com) application project // generated using an Application Wizard. #include "stdafx.h" #using <mscorlib.dll> #include <tchar.h> #using <System.dll> #using <System.Drawing.dll> #using <System.Windows.Forms.dll> #using <System.Data.dll> using namespace System; using namespace System::Drawing; using namespace System::Collections; using namespace System::ComponentModel; using namespace System::Windows::Forms; using namespace System::Data; namespace myspace { public __gc class Form1 : public System::Windows::Forms::Form { private: Button* button1; Label* label1; System::ComponentModel::Container* components; public: Form1() { // // Required for Windows Form Designer support // components = NULL; InitializeComponent(); // // TODO: Add any constructor code after // InitializeComponent call // } protected:
void Dispose( bool disposing ) { if( disposing ) { if (components != NULL) { components->Dispose(); } } Form::Dispose( disposing ); } private:
void InitializeComponent() { button1 = new Button(); label1 = new Label(); SuspendLayout(); // // button1 // button1->Location = Point(23, 96); button1->Size=System::Drawing::Size(100,60); button1->Name = "button1"; button1->TabIndex = 0; button1->Text = "Start my first C++(www.cppentry.com) WinForm Application"; button1->Click += new System::EventHandler(this, &Form1::button1_Click); // // label1 // label1->Location = Point(150, 84); label1->Name = "label1"; label1->TabIndex = 1; // // Form1 // AutoScaleBaseSize = System::Drawing::Size(5, 13); ClientSize = System::Drawing::Size(292, 273); Controls->Add(label1); Controls->Add(button1); Name = "Form1"; Text = "Form1"; ResumeLayout(false); } private: void button1_Click(Object* sender, System::EventArgs* e) { label1->Text = "Hello World!"; } }; } // This is the entry point for this application int __stdcall WinMain() { Application::Run(new myspace::Form1()); return 0; } |