Páginas

domingo, 27 de noviembre de 2011

"APLICACION UTILIZANDO LOS OBJETOS GRAFICOS BASICOS DE C#"





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Threading;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();


this.Text = "Fondo Lineas";

}

Random r = new Random();


private void timer1_Tick(object sender, EventArgs e)
{



}

private void button1_Click(object sender, EventArgs e)
{

}

private void Form1_Paint(object sender, PaintEventArgs e)
{

}

private void Form1_Resize(object sender, EventArgs e)
{
Invalidate();
}

private void timer1_Tick_1(object sender, EventArgs e)
{
Graphics g = CreateGraphics();

LinearGradientBrush lgb = new LinearGradientBrush(new Point(0, 0), new Point(r.Next(10, 20)), Color.Violet, Color.White);
g.FillRectangle(lgb, this.ClientRectangle);
lgb.Dispose();


}

private void button1_Click_1(object sender, EventArgs e)
{
timer1.Enabled = true;
timer2.Enabled = true;
}

private void timer2_Tick(object sender, EventArgs e)
{

Graphics g = this.CreateGraphics();
string cad = "Alejandra";

g.DrawString(cad, new Font("Arial", 20), Brushes.RoyalBlue, r.Next(10, 500),30);
Thread.Sleep(500);
}

private void button2_Click(object sender, EventArgs e)
{
timer2.Enabled = false;
timer1.Enabled = false;
this.Refresh();
}
}
}

No hay comentarios:

Publicar un comentario