7,540
社区成员
发帖
与我相关
我的任务
分享
#pragma once
void show();
namespace csdn {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Button^ show;
protected:
private:
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->show = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(12, 12);
this->textBox1->Multiline = true;
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(268, 195);
this->textBox1->TabIndex = 0;
//
// show
//
this->show->Location = System::Drawing::Point(100, 231);
this->show->Name = L"show";
this->show->Size = System::Drawing::Size(75, 23);
this->show->TabIndex = 1;
this->show->Text = L"show";
this->show->UseVisualStyleBackColor = true;
this->show->Click += gcnew System::EventHandler(this, &Form1::show_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 266);
this->Controls->Add(this->show);
this->Controls->Add(this->textBox1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void show_Click(System::Object^ sender, System::EventArgs^ e) {
show();
}
};
}
#include "stdafx.h"
#include "Form1.h"
using namespace csdn;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew Form1());
return 0;
}
void show(){
csdn::Form1::textBox1->Text=("Hello World\r\n");
}