C++ / CLI Windows Forms
16.07.2017(Всего голосов: 2)
->
Добавить новый элемент->
Visual C++->
UI->
Форма Windows FormsMyForm2.h
и жмем "Добавить".MyForm.h
и MyForm2.h
.#pragma once
добавим #include "MyForm2.h"
.MyForm2^ frm = gcnew MyForm2();
frm->Show(); //вызов формы 2
textBox
строку на форме 2 в textBox
на форме 1?public ref class MyForm2 : public System::Windows::Forms::Form
{
public:
// почти в самом верху добавим эти три строчки
String^ Str(){
return textBox1->Text;
}
button1
и button2
.button1
в разделе DialogResult
поставим OK. button2
в разделе DialogResult
поставим Cancel.MyForm2^ frm = gcnew MyForm2();
напишем:if(frm->ShowDialog()==System::Windows::Forms::DialogResult::OK){
String^ str = frm->Str();
textBox1->Text = str;
}