Documentos de Académico
Documentos de Profesional
Documentos de Cultura
En el extremo izquierdo se muestra la ventana del Explorador de soluciones, en el extremo derecho se muestran las ventanas del Cuadro de herramientas y Propiedades, y en la parte central se encuentra el formulario (Vista de Diseo) En la ventana Cuadro de herramientas, se encuentran los objetos que se van a colocar sobre el formulario, para lo cual se selecciona un objeto (se hace clic sobre l) y luego se coloca en el Ing. Zoraida Yanet Vidal Melgarejo, Mg. -1-
formulario. En la ventana de Propiedades podemos asignar o modificar las caractersticas de los objetos que se encuentran sobre el formulario. 1.5. En el formulario colocar los siguientes objetos.
TextBox
Label Button
ListBox TextBox
Button
1.6. Para cada uno de los objetos, establecer las siguientes propiedades.
Objeto label1 textBox1 label2 button1 label2 textBox2 button2 listBox1 button3 Propiedad Text Name Text Name MaxLength Text Name Text Name Text Name Text Name MaxLength Text Name Name Enabled Text Name Text Name ReadOnly TextAlign Text Name Text Name Valor Cantidad de notas a ingresar: lblElementos <en blanco> txtElementos 2 Nota: lblNota &Aceptar btnAceptar Nota: lblNota <en blanco> txtNota 2 &Ingresar btnIngresar lstLista False Nota &ms alta btnAlta <en blanco> txtAlta True Center &Nuevo txtNuevo &Salir txtSalir
textBox3
button4 button5
-2-
1.7. Clic derecho sobre el nombre del proyecto, seleccionar Agregar Clase.
1.9. Digitar el nombre de la clase, en este caso Notas. Seleccionar Inline. Clic en el botn Finalizar.
-3-
Universidad Nacional de Trujillo Ingeniera de Sistemas 1.10. Se observa el siguiente cdigo autogenerado.
-4-
} else { MessageBox::Show("Espacio insuficiente", "Arreglo lleno", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); return false; } } void imprimir(ListBox^ lista) { lista->Items->Clear(); for(int i=0; i<pos; i++) { String^ linea=gcnew String(""); linea+=Convert::ToString(listaNotas[i]); lista->Items->Add(linea); } } int notaMasAlta() { int alta=listaNotas[0]; for(int i=0; i<pos; i++) if(listaNotas[i] > alta) alta = listaNotas[i]; return alta; } };
Agregar texto
Agregar texto
-5-
1.13. Seleccionar la pestaa Form1.h [Diseo], y hacer doble clic sobre el botn Aceptar.
1.15. Seleccionar la pestaa Form1.h [Diseo], y hacer doble clic sobre el botn Ingresar.
private: System::Void btnIngresar_Click(System::Object^ System::EventArgs^ e) { int t = Convert::ToInt32(txtNota->Text); if(Nota->agregar(t)) { txtNota->Clear(); txtNota->Focus(); Nota->imprimir(lstLista); } else { txtNota->Clear(); txtNota->Enabled=false; btnIngresar->Enabled=false; } } sender,
-6-
1.16. Seleccionar la pestaa Form1.h [Diseo], y hacer doble clic sobre el botn Nota ms alta.
private: System::Void btnAlta_Click(System::Object^ System::EventArgs^ e) { int alta = Nota->notaMasAlta(); txtAlta->Text = Convert::ToString(alta); } sender,
1.17. Seleccionar la pestaa Form1.h [Diseo], y hacer doble clic sobre el botn Nuevo.
private: System::Void btnNuevo_Click(System::Object^ System::EventArgs^ e) { txtElementos->Clear(); txtElementos->Enabled=true; txtNota->Enabled=true; txtAlta->Clear(); txtAlta->Enabled=true; btnAceptar->Enabled=true; btnAlta->Enabled=true; btnIngresar->Enabled=true; lstLista->Items->Clear(); txtElementos->Focus(); } sender,
1.18. Seleccionar la pestaa Form1.h [Diseo], y hacer doble clic sobre el botn Salir.
private: System::Void btnSalir_Click(System::Object^ System::EventArgs^ e) { Close(); } }; //Fin de la clase Form1 } //Fin de namespace FrmArreglo1 sender,
-7-