Advertisement
NameL3ss

c# wea

Oct 9th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace TareaFormulario02
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20.  
  21. private void btnNuevo_Click(object sender, EventArgs e)
  22. {
  23. Form fa = new Form(); //crear nuevo formulario
  24.  
  25. fa.Text = "Nuevo formulario"; //crear el titulo
  26.  
  27. fa.Name = "Nuevo"; //crear nombre
  28.  
  29.  
  30.  
  31. fa.Size = new Size(300, 200); //crear tamaño para formulario
  32.  
  33.  
  34. fa.BackColor = Color.Red; // color para el formulario
  35.  
  36. fa.Load += fa_Load;
  37.  
  38. fa.Visible = true; //mostrar formulario
  39. //fa.ShowDialog(); //mostrar el nuevo formulario
  40.  
  41. fa.SetDesktopLocation(400, 100); //ubicacion de los formularios en el escritorio
  42.  
  43.  
  44.  
  45.  
  46. }
  47.  
  48.  
  49. public void fa_Load(object sender, EventArgs e)
  50. {
  51. Form fb = (Form)sender;
  52.  
  53. //http://support2.microsoft.com/kb/319266/es
  54.  
  55. //Numero 1
  56. Label numero1 = new Label();
  57. numero1.Text = "Numero 1:";
  58. numero1.ForeColor = Color.White;
  59. numero1.Location = new Point(20, 20);
  60. TextBox txtNumero1 = new TextBox();
  61. txtNumero1.Name = "txtNumero1";
  62. txtNumero1.Location = new Point(120, 18);
  63.  
  64. //Numero 2
  65. Label numero2 = new Label();
  66. numero2.Text = "Numero 2:";
  67. numero2.ForeColor = Color.White;
  68. numero2.Location = new Point(20, 52);
  69. TextBox txtNumero2 = new TextBox();
  70. txtNumero2.Name = "txtNumero2";
  71. txtNumero2.Location = new Point(120, 50);
  72.  
  73.  
  74. //Boton Sumar
  75. Button btnSumar = new Button();
  76. btnSumar.Name = "Sumar";
  77. btnSumar.Text = "Sumar";
  78. btnSumar.BackColor = Color.White;
  79. btnSumar.Location = new Point(100, 100);
  80.  
  81.  
  82. //Agregar controles
  83. fb.Controls.Add(numero1);
  84. fb.Controls.Add(numero2);
  85. fb.Controls.Add(txtNumero1);
  86. fb.Controls.Add(txtNumero2);
  87. fb.Controls.Add(btnSumar);
  88. }
  89.  
  90.  
  91. public void btn_Sumar(object sender, EventArgs e)
  92. {
  93.  
  94. }
  95.  
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement