Въпрос За C++

jefriii

Registered
имам въпрос за C++ сега започнах и ми трябва малко помощ след като създам Windows Forms App ми създава файл със следният код.Вече разучих че този код съсържа размерите,името и хилядите глупости да направи прозорец въпроса ми е като имам код как да го сложа в този прозорец ?

Код:
#pragma once


namespace NewName {

	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>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->SuspendLayout();
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(292, 266);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
			 }
	};
}
 
:idea:
Питам те просто какво примерно искаш да направиш.. Ти какво очакваш? Да намериш някакъв код и да напишеш нещо от рода на това:
I::Want::This::Code::Here? Проблема си е твой. Чакай си.
Надявам се модераторите да се смелят над мен и да получа само забележка за това мнение.
 
а да май забрави да отговориш на въпроса ми аре ще ти кажа като зьа начало ще изпрабвам пърият урок от този сайт Hello World къде да го сложа ?
 
Замени предишния код от Form1.h със този:
Код:
#pragma once


namespace sample {

	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>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  button1;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::TextBox^  textBox1;
	protected: 

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
			this->SuspendLayout();
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(65, 12);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(153, 23);
			this->button1->TabIndex = 0;
			this->button1->Text = L"Press me to say Hello World";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(86, 80);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(124, 13);
			this->label1->TabIndex = 1;
			this->label1->Text = L"A label, press the button.";
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(89, 138);
			this->textBox1->Name = L"textBox1";
			this->textBox1->Size = System::Drawing::Size(100, 20);
			this->textBox1->TabIndex = 2;
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(292, 269);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->button1);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
				 MessageBox::Show("Hello World!", "Hello!");
                                                                 label1->Text = "Hello world2";
				 textBox1->Text = "Hello world3";
				
			 }
	};
}
Разгледай кода(най-вече void функцията button1_Click). Това са само малки примерчета, има още много начини.
 
пак не става даже имаше 9 грешки аз направих нов и се опитах да вградя това но пускам програмата и си ми е само прозореца няма нищо в него

Код:
#pragma once


namespace kkkkkkkkkkkkkkkk {

	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>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
   private: System::Windows::Forms::Button^  button1;
   private: System::Windows::Forms::Label^  label1;
   private: System::Windows::Forms::TextBox^  textBox1;
   protected: 
	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->button1 = (gcnew System::Windows::Forms::Button());
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->textBox1 = (gcnew System::Windows::Forms::TextBox());
         this->SuspendLayout();
         //
         // button1
         //
         this->button1->Location = System::Drawing::Point(65, 12);
         this->button1->Name = L"button1";
         this->button1->Size = System::Drawing::Size(153, 23);
         this->button1->TabIndex = 0;
         this->button1->Text = L"Press me to say Hello World";
         this->button1->UseVisualStyleBackColor = true;
         this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
         //
         // label1
         //
         this->label1->AutoSize = true;
         this->label1->Location = System::Drawing::Point(86, 80);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(124, 13);
         this->label1->TabIndex = 1;
         this->label1->Text = L"A label, press the button.";
         //
         // textBox1
         //
         this->textBox1->Location = System::Drawing::Point(89, 138);
         this->textBox1->Name = L"textBox1";
         this->textBox1->Size = System::Drawing::Size(100, 20);
         this->textBox1->TabIndex = 2;
         //
         // Form1
         //
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(292, 269);
         this->Controls->Add(this->textBox1);
         this->Controls->Add(this->label1);
         this->Controls->Add(this->button1);
         this->Name = L"Form1";
         this->Text = L"Form1";
         this->ResumeLayout(false);
         this->PerformLayout(); 

			this->SuspendLayout();
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(292, 266);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)
			 System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e){
             MessageBox::Show("Hello World!", "Hello!");
                                                                 label1->Text = "Hello world2";
             textBox1->Text = "Hello world3"; {
			 }
	};
}
 

Back
Горе