Programmare++
20-11-2008, 17:18
Come si fa a dare instruzioni ad un bottone in C++?
Ho questo codice:
#pragma once
namespace SystemproProgram {
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>
/// Riepilogo per Form1
///
/// AVVISO: se si modifica il nome della classe, sarà necessario modificare la
/// proprietà 'Nome file di risorse' relativa allo strumento Compilatore di risorse gestite
/// associato a tutti i file RESX da cui dipende la classe. In caso contrario,
/// le finestre di progettazione non saranno in grado di interagire correttamente con le
/// risorse localizzate associate al form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: aggiungere qui il codice del costruttore.
//
}
protected:
/// <summary>
/// Liberare le risorse in uso.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private:
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(769, 589);
this->button1->Name = L"Apri File";
this->button1->Size = System::Drawing::Size(94, 39);
this->button1->TabIndex = 0;
this->button1->Text = L"Apri quel file";
this->button1->UseVisualStyleBackColor = true;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(933, 655);
this->Controls->Add(this->button1);
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) {
}
};
}
Come faccio a dire che quando premo il bottone deve aprirmi un file specificato?
Ho questo codice:
#pragma once
namespace SystemproProgram {
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>
/// Riepilogo per Form1
///
/// AVVISO: se si modifica il nome della classe, sarà necessario modificare la
/// proprietà 'Nome file di risorse' relativa allo strumento Compilatore di risorse gestite
/// associato a tutti i file RESX da cui dipende la classe. In caso contrario,
/// le finestre di progettazione non saranno in grado di interagire correttamente con le
/// risorse localizzate associate al form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: aggiungere qui il codice del costruttore.
//
}
protected:
/// <summary>
/// Liberare le risorse in uso.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private:
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(769, 589);
this->button1->Name = L"Apri File";
this->button1->Size = System::Drawing::Size(94, 39);
this->button1->TabIndex = 0;
this->button1->Text = L"Apri quel file";
this->button1->UseVisualStyleBackColor = true;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(933, 655);
this->Controls->Add(this->button1);
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) {
}
};
}
Come faccio a dire che quando premo il bottone deve aprirmi un file specificato?