sábado, 26 de marzo de 2011

DIBUJAR UN VECTOR EN C#




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 vector
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

      

        private void btndraw_Click(object sender, EventArgs e)
        {

            // linea vertical
            int x1v=250;
            int x2v=250;
            int y1v=0;
            int y2v=500;
            //linea horizontal
            int x1h = 0;
            int x2h = 500;
            int y1h = 250;
            int y2h = 250;
           
            Graphics g;
            g = this.CreateGraphics();
            Pen p;
            p = new Pen(Color.Brown,5);
            g.DrawLine(p, x1v, y1v, x2v, y2v);
                  
            g.DrawLine(p, x1h, y1h, x2h, y2h);
        }

        private void btnline_Click(object sender, EventArgs e)
        {
            int x1v = Width/2;
            int x2v = 500;
            int y1v = Height/2;
            int y2v = 0;

            Graphics g;
            g = this.CreateGraphics();
            Pen p;
            p = new Pen(Color.Blue, 5);
            g.DrawLine(p, x1v, y1v, x2v, y2v);
        }
    }
}


PARA MAS INFORMACIÓN VISITA:
COMUNIDAD ROAD RUNNERS
EL NUEVO REPOSITORIO

No hay comentarios:

Publicar un comentario