Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace TareaFormulario02
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnNuevo_Click(object sender, EventArgs e)
- {
- Form fa = new Form(); //crear nuevo formulario
- fa.Text = "Nuevo formulario"; //crear el titulo
- fa.Name = "Nuevo"; //crear nombre
- fa.Size = new Size(300, 200); //crear tamaño para formulario
- fa.BackColor = Color.Red; // color para el formulario
- fa.Load += fa_Load;
- fa.Visible = true; //mostrar formulario
- //fa.ShowDialog(); //mostrar el nuevo formulario
- fa.SetDesktopLocation(400, 100); //ubicacion de los formularios en el escritorio
- }
- public void fa_Load(object sender, EventArgs e)
- {
- Form fb = (Form)sender;
- //http://support2.microsoft.com/kb/319266/es
- //Numero 1
- Label numero1 = new Label();
- numero1.Text = "Numero 1:";
- numero1.ForeColor = Color.White;
- numero1.Location = new Point(20, 20);
- TextBox txtNumero1 = new TextBox();
- txtNumero1.Name = "txtNumero1";
- txtNumero1.Location = new Point(120, 18);
- //Numero 2
- Label numero2 = new Label();
- numero2.Text = "Numero 2:";
- numero2.ForeColor = Color.White;
- numero2.Location = new Point(20, 52);
- TextBox txtNumero2 = new TextBox();
- txtNumero2.Name = "txtNumero2";
- txtNumero2.Location = new Point(120, 50);
- //Boton Sumar
- Button btnSumar = new Button();
- btnSumar.Name = "Sumar";
- btnSumar.Text = "Sumar";
- btnSumar.BackColor = Color.White;
- btnSumar.Location = new Point(100, 100);
- //Agregar controles
- fb.Controls.Add(numero1);
- fb.Controls.Add(numero2);
- fb.Controls.Add(txtNumero1);
- fb.Controls.Add(txtNumero2);
- fb.Controls.Add(btnSumar);
- }
- public void btn_Sumar(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement