Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 16.10.2009, 19:21   #1
Many man
Пользователь
 
Регистрация: 25.11.2008
Сообщений: 83
По умолчанию Помогите переделать программу на VS C++

Вобщем есть графическая программа сделанная в Visual Studio(Windows Form Aplication)
Вот заголовочный файл classes.h

Код:
//////////////////////////////////////////////
//	Parent Class							//
//////////////////////////////////////////////

class ParentPicture {
public:
	virtual void Print(System::Windows::Forms::PictureBox ^pbx);
};

void ParentPicture::Print(System::Windows::Forms::PictureBox ^pbx) {
	pbx->ImageLocation=L"parent.bmp";
}

//////////////////////////////////////////////
//	Child Class #1							//
//////////////////////////////////////////////

class ChildPicture1: public ParentPicture {
public:
	void Print(System::Windows::Forms::PictureBox ^pbx);
};

void ChildPicture1::Print(System::Windows::Forms::PictureBox ^pbx) {
	pbx->ImageLocation=L"child1.bmp";
}

//////////////////////////////////////////////
//	Child Class #2							//
//////////////////////////////////////////////

class ChildPicture2: public ParentPicture {
public:
	void Print(System::Windows::Forms::PictureBox ^pbx);
};

void ChildPicture2::Print(System::Windows::Forms::PictureBox ^pbx) {
	pbx->ImageLocation=L"child2.bmp";
}

//////////////////////////////////////////////
//	Function That Uses Virtual Methods		//
//////////////////////////////////////////////

void ShowPicture(ParentPicture* pp, System::Windows::Forms::PictureBox^ pbx) {
	pp->Print(pbx);
}
Эта программа выводит изображение в Picturebox, при нажатии одной из кнопок. Нужно переделать чтобы вместо картинок выводил текст.
Помогите пожалуйста очень надо.

Последний раз редактировалось Many man; 16.10.2009 в 19:29.
Many man вне форума Ответить с цитированием
Старый 16.10.2009, 19:26   #2
Many man
Пользователь
 
Регистрация: 25.11.2008
Сообщений: 83
По умолчанию

А это файл Form1.h
Код:
#pragma once

#include "classes.h"

namespace ex1_gui {
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
	
	/// </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^  btnShowParent;
	protected: 
	private: System::Windows::Forms::Button^  btnShowChild1;
	private: System::Windows::Forms::Button^  btnShowChild2;
	private: System::Windows::Forms::PictureBox^  pbxImage;
private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

		/// my code
		
		//ChildPicture1 cp1;
		//ChildPicture2 cp2;
#pragma region Windows Form Designer generated code
		/// <summary>
		
		/// </summary>
		void InitializeComponent(void)
		{
			this->btnShowParent = (gcnew System::Windows::Forms::Button());
			this->btnShowChild1 = (gcnew System::Windows::Forms::Button());
			this->btnShowChild2 = (gcnew System::Windows::Forms::Button());
			this->pbxImage = (gcnew System::Windows::Forms::PictureBox());
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pbxImage))->BeginInit();
			this->SuspendLayout();
			// 
			// btnShowParent
			// 
			this->btnShowParent->Location = System::Drawing::Point(12, 231);
			this->btnShowParent->Name = L"btnShowParent";
			this->btnShowParent->Size = System::Drawing::Size(75, 23);
			this->btnShowParent->TabIndex = 0;
			this->btnShowParent->Text = L"Parent";
			this->btnShowParent->UseVisualStyleBackColor = true;
			this->btnShowParent->Click += gcnew System::EventHandler(this, &Form1::btnShowParent_Click);
			// 
			// btnShowChild1
			// 
			this->btnShowChild1->Location = System::Drawing::Point(109, 231);
			this->btnShowChild1->Name = L"btnShowChild1";
			this->btnShowChild1->Size = System::Drawing::Size(75, 23);
			this->btnShowChild1->TabIndex = 1;
			this->btnShowChild1->Text = L"Child 1";
			this->btnShowChild1->UseVisualStyleBackColor = true;
			this->btnShowChild1->Click += gcnew System::EventHandler(this, &Form1::btnShowChild1_Click);
			// 
			// btnShowChild2
			// 
			this->btnShowChild2->Location = System::Drawing::Point(205, 231);
			this->btnShowChild2->Name = L"btnShowChild2";
			this->btnShowChild2->Size = System::Drawing::Size(75, 23);
			this->btnShowChild2->TabIndex = 2;
			this->btnShowChild2->Text = L"Child 2";
			this->btnShowChild2->UseVisualStyleBackColor = true;
			this->btnShowChild2->Click += gcnew System::EventHandler(this, &Form1::btnShowChild2_Click);
			// 
			// pbxImage
			// 
			this->pbxImage->Location = System::Drawing::Point(12, 12);
			this->pbxImage->Name = L"pbxImage";
			this->pbxImage->Size = System::Drawing::Size(268, 213);
			this->pbxImage->SizeMode = System::Windows::Forms::PictureBoxSizeMode::AutoSize;
			this->pbxImage->TabIndex = 3;
			this->pbxImage->TabStop = false;
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(292, 266);
			this->Controls->Add(this->pbxImage);
			this->Controls->Add(this->btnShowChild2);
			this->Controls->Add(this->btnShowChild1);
			this->Controls->Add(this->btnShowParent);
			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
			this->MaximizeBox = false;
			this->Name = L"Form1";
			this->Text = L"Pol";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pbxImage))->EndInit();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
private: System::Void btnShowParent_Click(System::Object^  sender, System::EventArgs^  e) {
			 ParentPicture pic;
			 ShowPicture(&pic,pbxImage);}
private: System::Void btnShowChild1_Click(System::Object^  sender, System::EventArgs^  e) {
			 ChildPicture1 pic;
			 ShowPicture(&pic,pbxImage);}
private: System::Void btnShowChild2_Click(System::Object^  sender, System::EventArgs^  e) {
			 ChildPicture2 pic;
			 ShowPicture(&pic,pbxImage);}
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {}
};
}
Many man вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Помогите переделать программу. Valentin49 Помощь студентам 1 26.03.2009 13:58
Помогите переделать программу немного. texcel Общие вопросы C/C++ 1 16.02.2009 19:42
Нужно переделать программу? bamer Фриланс 6 28.12.2008 17:12
Помогите переделать программу в Delphi7… Лисичкина Помощь студентам 1 31.10.2008 19:08
ПОМОГИТЕ ПЕРЕДЕЛАТЬ ПРОГРАММУ ИЗ PASCAL В DELPHI Solny6ko YasnoE Помощь студентам 11 11.08.2007 15:24