
DUDA IMPORTANTE
Publicado por Isabel (1 intervención) el 03/12/2013 17:12:03
Hola, soy nueva con visualc++ y llevo varios días intentando hecer un programa sencillo:
Un formulario con un boton que al pulsarlo me muestre un mensaje. Os pongo el código:
el .h
el .cpp
Un formulario con un boton que al pulsarlo me muestre un mensaje. Os pongo el código:
el .h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once
namespace boton {
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>
/// Resumen de Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: agregar código de constructor aquí
//
}
protected:
/// <summary>
/// Limpiar los recursos que se estén utilizando.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ btnAgregar;
protected:
private:
/// <summary>
/// Variable del diseñador requerida.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Método necesario para admitir el Diseñador. No se puede modificar
/// el contenido del método con el editor de código.
/// </summary>
void InitializeComponent(void)
{
this->btnAgregar = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// btnAgregar
//
this->btnAgregar->ForeColor = System::Drawing::SystemColors::ActiveCaption;
this->btnAgregar->Location = System::Drawing::Point(144, 77);
this->btnAgregar->Name = L"btnAgregar";
this->btnAgregar->Size = System::Drawing::Size(75, 23);
this->btnAgregar->TabIndex = 0;
this->btnAgregar->Text = L"agregar";
this->btnAgregar->UseVisualStyleBackColor = true;
this->btnAgregar->Click += gcnew System::EventHandler(this, &Form1::btnAgregar_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->Controls->Add(this->btnAgregar);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void btnAgregar_Click(System::Object^ sender, System::EventArgs^ e) {
printf("Introduzca su mes de nacimiento(DE 1 A 12): ");
//cout << "funciona" << endl;
// Form1::Close();
}
};
}
el .cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "stdafx.h"
#include "Form1.h"
//#include <iostream>
#include <stdio.h>
//using namespace std;
using namespace boton;
struct tipoRegistro {
int edad;
float altura;
};
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Habilitar los efectos visuales de Windows XP antes de crear ningún control
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Crear la ventana principal y ejecutarla
Application::Run(gcnew Form1());
return 0;
}
Valora esta pregunta


0