Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Manual de Prc3a1cticas en Modular C PDF
Manual de Prc3a1cticas en Modular C PDF
Sólo código
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Primer_aplicacion
{
public partial class frmHola : Form
{
public frmHola()
{
InitializeComponent();
}
/* Diagonal + asterisco,
* nos permite realizar
* comentarios de varias
* lineas*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Manejo_de_formularios
{
public partial class frmFormulario1 : Form
{
public frmFormulario1()
{
InitializeComponent();
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Manejo_de_formularios
{
public partial class frmFormulario2 : Form
{
public frmFormulario2()
{
InitializeComponent();
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Agenda
{
public partial class frmAgenda: Form
{
String Nombre, Apellido;
public frmAgenda()
{
InitializeComponent();
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Calculadora
{
public partial class frmCalculadora : Form
{
int num1, num2, resp;
string opc;
double res;
public frmCalculadora()
{
InitializeComponent();
}
/*num1 = int.Parse(txtNum1.Text);
num2 = int.Parse(txtNum2.Text);
num1 = Convert.ToDouble(txtNum1.Text);
num2 = Convert.ToDouble(txtNum2.Text);*/
//txtResultado.Text = Convert.ToString(resp);
MessageBox.Show("El resultado es: " + resp);
}
if (opc == "+")
{
res = num1 + num2;
if (opc == "-")
{
res = num1 - num2;
MessageBox.Show("La Resta de la Cantidad es " + res.ToString());
}
if (opc == "*")
{
res = num1 * num2;
MessageBox.Show("La Multiplicacion de las Cantidades es " +
res.ToString());
}
if (opc == "/")
{
res = num1 / num2;
MessageBox.Show("La Division de las Cantidades es " + res.ToString());
}
/*txtNum1.Text = "";
txtNum2.Text = "";
txtNum1.Focus();
cmbOperacion.Text = "";*/
}
catch (DivideByZeroException)
{
MessageBox.Show("Error la división no es divisible entre 0", "Mensaje de
Error");
txtNum1.Text = "";
txtNum2.Text = "";
txtNum1.Focus();
cmbOperacion.Text = "";
}
catch (FormatException)
{
MessageBox.Show("Error Escriba los datos correctamente", "Mensaje de
Error");
txtNum1.Text = "";
txtNum2.Text = "";
txtNum1.Focus();
}
}
}
}
namespace Practica07
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnColor_Click(object sender, EventArgs e)
{
ColorDialog MyDialog = new ColorDialog();
// Keeps the user from selecting a custom color.
MyDialog.AllowFullOpen = false;
// Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = true;
// Sets the initial color select to the current text color.
MyDialog.Color = txtColor.ForeColor;
// Update the text box color if the user clicks OK
if (MyDialog.ShowDialog() == DialogResult.OK)
txtColor.ForeColor = MyDialog.Color;
}
private void btnFont_Click(object sender, EventArgs e)
{
fontDialog1.ShowColor = true;
fontDialog1.Font = txtColor.Font;
fontDialog1.Color = txtColor.ForeColor;
if (fontDialog1.ShowDialog() != DialogResult.Cancel)
{
txtColor.Font = fontDialog1.Font;
txtColor.ForeColor = fontDialog1.Color;
}
}
private void btnOpen_Click(object sender, EventArgs e)
{
string foto;
//Definimos los filtros de archivos a permitir, en este caso imagenes
openFileDialog1.Filter = "Bitmap files (*.bmp)|*.bmp|Gif files (*.gif)|*.gif|JGP files
(*.jpg)|*.jpg|All (*.*)|*.* |PNG (*.paisaje)|*.png ";
//Establece que filtro se mostrará por defecto en este caso, 3=jpg
openFileDialog1.FilterIndex = 3;
//Esto aparece en el Nombre del archivo a seleccionar, se puede quitar no es fundamental
openFileDialog1.FileName="Seleccione una imagen";
//El titulo de la Ventana....
openFileDialog1.Title = "Paisaje";
//El directorio que por defecto abrirá, para cada contrapleca del Path colocar \\
C:\\Fotitos\\Wizard y así sucesivamente
openFileDialog1.InitialDirectory = "c:\\";
/// Evalúa que si al aparecer el cuadro de dialogo la persona presionó Ok
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
/// Si esto se cumple, capturamos la propiedad File Name y la guardamos en la variable foto
foto = openFileDialog1.FileName;
//Por ultimo se la asignamos al PictureBox
pctImagen.Image = Image.FromFile(@foto);
}
}
}
}
namespace Fecha_hora
{
public partial class frmFechahora : Form
{
public frmFechahora()
{
InitializeComponent();
}
namespace Formas
{
public partial class frmDrawing : Form
{
public frmDrawing()
{
InitializeComponent();
Graphics dc = this.CreateGraphics();
this.Show();
Pen BluePen = new Pen(Color.Blue, 3);
dc.DrawRectangle(BluePen, 100, 300, 300, 50);
Pen RedPen = new Pen(Color.Red, 5);
dc.DrawEllipse(RedPen, 220, 200, 60, 60);
dc.DrawEllipse(RedPen, 150, 100, 60, 60);
dc.DrawEllipse(RedPen, 300, 100, 60, 60);
}
/*System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Red);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawEllipse(myPen, new Rectangle(0, 0, 200, 300));
myPen.Dispose();
formGraphics.Dispose();*/
}
namespace Office
{
public partial class frmOffice : Form
{
public frmOffice()
{
InitializeComponent();
}
private void btnWord_Click_1(object sender, EventArgs e)
{
object missing = System.Reflection.Missing.Value;
object Visible = true;
object start1 = 0;
object end1 = 0;
ApplicationClass WordApp = new ApplicationClass();
Document adoc = WordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Range rng = adoc.Range(ref start1, ref missing);
try
{
rng.Font.Name = "Georgia";
rng.InsertAfter("Bienvenido!");
object filename = @"D:\MyWord.doc";
adoc.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref
missing, ref missing);
WordApp.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void btnAbrir_Click_1(object sender, EventArgs e)
{
string foto;
openFileDialog1.Filter = "Documentos de Word (*.doc)|*.doc|Documentos de Excel
(*.xls)|*.xls|Documentos de PowerPoint (*.pnt)|*.pnt|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
openFileDialog1.FileName = "Seleccione un archivo";
openFileDialog1.Title = "Archivo";
openFileDialog1.InitialDirectory = "C:\\Documents and Settings\\José Raymundo Ceja\\My
Documents";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
foto = openFileDialog1.FileName;
//pnlContenedor.Container = Container.Add(@foto);
}
}
}
}
namespace OfficeWindows
{
public partial class Form1 : Form
{
public Object oDoc;
public string FileName;
public Form1()
{
InitializeComponent();
this.webBrowser1.DocumentCompleted += new
WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted_1);
}
if (FileName.Length != 0)
{
Object refmissing = System.Reflection.Missing.Value;
oDoc = null;
webBrowser1.Navigate(FileName);
}
}
namespace Explorador_Web
{
public partial class frmNavegador : Form
{
public frmNavegador()
{
InitializeComponent();
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//using System.
namespace Numeros_aleatorios
{
public partial class frmAleatorios : Form
{
public frmAleatorios()
{
InitializeComponent();
}
private Random obj = new Random();