Форма

Модераторы: Hawk, Romeo, Absurd, DeeJayC, WinMain

Ответить
Maray
Сообщения: 11
Зарегистрирован: 22 ноя 2015, 20:56

Добрый день!

Помогите, пожалуйста. Есть программа, которая открывает форму

Код: Выделить всё

#include "stdafx.h"
#include "Form1.h"

using namespace My55;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 
	Application::Run(gcnew Form1());
	return 0;
}
В этой форме в два поля вводится информация. И есть две кнопки, при нажатии на которые вызывается та или иная подпрограмма.

Как сделать, чтобы введенная информация в двух полях записывалась в две переменные(тип переменных char*), а при нажатии на кнопку вызывалась процедура?
Maray
Сообщения: 11
Зарегистрирован: 22 ноя 2015, 20:56

Код формы:

Код: Выделить всё

#pragma once

namespace My55 {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System: :D ata;
	using namespace System: :D rawing;

	/// <summary>
	/// Сводка для Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: добавьте код конструктора
			//
		}

	protected:
		/// <summary>
		/// Освободить все используемые ресурсы.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}

	protected: 




	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::Button^  button1;

	private: System::Windows::Forms::TextBox^  textBox1;
	private: System::Windows::Forms::Button^  button2;
	private: System::Windows::Forms::TextBox^  textBox2;



	private:
		/// <summary>
		/// Требуется переменная конструктора.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Обязательный метод для поддержки конструктора - не изменяйте
		/// содержимое данного метода при помощи редактора кода.
		/// </summary>
		void InitializeComponent(void)
		{
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->label2 = (gcnew System::Windows::Forms::Label());
			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->SuspendLayout();
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System: :D rawing::Point(27, 29);
			this->label1->Name = L"label1";
			this->label1->Size = System: :D rawing::Size(78, 13);
			this->label1->TabIndex = 2;
			this->label1->Text = L"Входной файл";
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Location = System: :D rawing::Point(25, 117);
			this->label2->Name = L"label2";
			this->label2->Size = System: :D rawing::Size(86, 13);
			this->label2->TabIndex = 3;
			this->label2->Text = L"Выходной файл";
			// 
			// button1
			// 
			this->button1->Location = System: :D rawing::Point(30, 215);
			this->button1->Name = L"button1";
			this->button1->Size = System: :D rawing::Size(95, 23);
			this->button1->TabIndex = 4;
			this->button1->Text = L"Кодировать";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click_1);
			// 
			// textBox1
			// 
			this->textBox1->Location = System: :D rawing::Point(28, 147);
			this->textBox1->Name = L"textBox1";
			this->textBox1->Size = System: :D rawing::Size(153, 20);
			this->textBox1->TabIndex = 6;
			// 
			// button2
			// 
			this->button2->Location = System: :D rawing::Point(157, 215);
			this->button2->Name = L"button2";
			this->button2->Size = System: :D rawing::Size(95, 23);
			this->button2->TabIndex = 5;
			this->button2->Text = L"Декодировать";
			this->button2->UseVisualStyleBackColor = true;
			this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
			// 
			// textBox2
			// 
			this->textBox2->Location = System: :D rawing::Point(28, 62);
			this->textBox2->Name = L"textBox2";
			this->textBox2->Size = System: :D rawing::Size(153, 20);
			this->textBox2->TabIndex = 7;
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System: :D rawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System: :D rawing::Size(284, 262);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->label1);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
			 }
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
			 }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void saveFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
		 }
private: System::Void saveFileDialog2_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
		 }

};
}
Ответить