Vous êtes sur la page 1sur 3

using using using using using using using using using

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

namespace plano_cartesiano { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public static int x, y, marca_x, marca_y, numero, xxx, escala = 30; private void Form1_Load(object sender, EventArgs e) { } private void Form1_Paint(object sender, PaintEventArgs e) { } private void button1_Click(object sender, EventArgs e) { Graphics fondo = this.CreateGraphics();////es el lugar donde se dibu juja, como un papel Pen brocha_x = new Pen(Color.Blue,3);//brocha de color negro para ca da eje Pen brocha_y = new Pen(Color.Blue,3); Pen figura = new Pen(Color.Blue,3);//brocha para dibujar la figuja d e azul SolidBrush punto = new SolidBrush(Color.Black);//brocha para colocar un punto rojo de referencia en la figura x = (this.Width) / 2;//x guarda la medida de la mitad de lo largo d ela ventana y = (this.Height) / 2;//y guarda la medida de la mitad de lo alto d ela ventana

marca_x = (this.Width) / 2; marca_y = (this.Height) / 2; ////////////////////////dibuja el eje x//////////////////////////////////// fondo.DrawLine(brocha_x,0,marca_y,this.Width,marca_y); ///////////////////dibuja las marca en el eje x positivo(la escalas con circulit os)////////// xxx = marca_x;

numero = 1;//variable ke incrementa para mostrar las etiketas de los ejes for (int i = xxx; i <= this.Width; i=i+escala) { fondo.FillEllipse(punto, marca_x - 2, marca_y - 3, 8, 8);//dibuj o los puntos Label a = new Label();//creo etiketas a.Location = new Point(marca_x + escala, marca_y + 10); a.AutoSize = true; a.Font = new Font("Arial", 6); this.Controls.Add(a); a.Text = numero.ToString();//muestro en las etikitas los numeor ke ira incrementando marca_x = marca_x + escala;//me muevo en el eje x de 30 en 30 pa ra colocar el siguiente nuemor y punto numero++;//incremtno el nuemor ke sigue } /////////////////////dibuja las marcas del eje x negativo////////////////// marca_x = (this.Width) / 2; xxx = marca_x; numero = 1; for (int i = xxx; i >= 0 ; i=i-escala) { fondo.FillEllipse(punto, marca_x - 2, marca_y - 3, 8, 8); Label a = new Label(); a.Location = new Point(marca_x - escala, marca_y + 10); a.AutoSize = true; a.Font = new Font("Arial", 6); this.Controls.Add(a); a.Text = "-" + numero.ToString();//colo un signo menos mas el nu mero ke ira para el eje negativo marca_x = marca_x - escala; numero++; } marca_x = (this.Width) / 2; marca_y = (this.Height) / 2; //////////////////////////dibuja el eje y////////////////////////////////// fondo.DrawLine(brocha_y,marca_x,0,marca_x,this.Height); ////////////////////////dibuja las marcas del eje y negativo//////////////////// //// xxx = marca_y; numero = 1; for (int i = xxx; i <=this.Height ; i=i+escala) { Label a = new Label(); a.Location = new Point(marca_x + 10, marca_y + escala); a.AutoSize = true; a.Font = new Font("Arial", 6); this.Controls.Add(a);

a.Text = "-" + numero.ToString(); fondo.FillEllipse(punto, marca_x - 2, marca_y - 3, 8, 8); marca_y = marca_y + escala; numero++; } ////////////////////////dibuja las marcas del eje y positivo/////////////////// ///// marca_x = (this.Width) / 2; marca_y = (this.Height) / 2; xxx = marca_y; numero = 1; for (int i = xxx; i >=0 ; i=i-escala) { fondo.FillEllipse(punto, marca_x - 2, marca_y - 3, 8, 8); Label a = new Label(); a.Location = new Point(marca_x + 10, marca_y - escala); a.Font = new Font("Arial", 6); a.AutoSize = true; this.Controls.Add(a); a.Text = " " + numero.ToString(); marca_y = marca_y - escala; numero++; } } private void button2_Click(object sender, EventArgs e) { Graphics fondo = this.CreateGraphics(); SolidBrush figura = new SolidBrush(Color.Fuchsia); SolidBrush punto = new SolidBrush(Color.Fuchsia); Pen linea = new Pen(Color.Fuchsia, 3); }

} }

Vous aimerez peut-être aussi