//al cargar formulario private void FormEscenario_Load(object sender, EventArgs e) { msnlbl.Text = "Click en el cuadro para fijar ejes"; G.Escenario.Centro = new Punto(0, 0); G.Escenario.EjeVisible = true; ejeVisible.Checked = true; PanelDibujo.Location = new Point(15, 88); //caso especial para usar point timer.Stop(); Graphics gr = PanelDibujo.CreateGraphics(); G.Pintor = new Pintor(ref gr); //creo una animacion por defecto Animacion ani = new Animacion(); //creo una animacion vacia ani.addMatriz(new Matriz(1.005, true)); // le inserto una matriz de escalamiento que crece ani.addMatriz(new Matriz(2.0)); //le inserto una matriz de rotacion con angulo 2 ani.addMatriz(new Matriz(2, 0)); //le inserto una matriz de trslacion en eje x =2, y= 0 List <Animacion> anis = new List <Animacion>(); //añado la animacion a una lista de animaciones anis.Add(ani); G.Animaciones = anis; // seteo la lista en el campo animaciones de mi GRAFICADOR //fin crear animacion por defecto dimensionarInterfaz(); actEtiquetas(); }
private void dibujarEscenario() { Graphics gr = PanelDibujo.CreateGraphics(); Pen pen = new Pen(Color.Olive); G.Pintor = new Pintor(ref gr, pen); G.Pintor.dibujarEscenario(G.Escenario);//dibujar escenario con putos relativos }
private void dibujarEjes() { if (G.Escenario.EjeVisible) { Pen pen = new Pen(Color.Red); Graphics gr = PanelDibujo.CreateGraphics(); G.Pintor = new Pintor(ref gr, pen); List <Punto> py = new List <Punto>(); py.Add(new Punto(G.Escenario.Centro.X, 0)); py.Add(new Punto(G.Escenario.Centro.X, PanelDibujo.Height)); Poligono ejey = new Poligono(py, Poligono.TipoPoligono.Abierto); Poligono ejex = new Poligono(new Punto(0, G.Escenario.Centro.Y)); ejex.Add(new Punto(PanelDibujo.Width, G.Escenario.Centro.Y)); ejex.Tipo_Poligono = Poligono.TipoPoligono.Abierto; G.Pintor.dibujarPoligono(ejey);//poligonos absolutos G.Pintor.dibujarPoligono(ejex); } }
private void dibujarTemporales() { Pen pen = new Pen(Color.Blue); Graphics gr = PanelDibujo.CreateGraphics(); G.Pintor = new Pintor(ref gr, pen); if (nPuntos == 1) { double x = puntosTemporales[0].X + G.Escenario.Centro.X; double y = puntosTemporales[0].Y + G.Escenario.Centro.Y; G.Pintor.dibujarPunto(new Punto(x, y)); } else { Punto aF = new Punto(puntosTemporales[nPuntos - 1].X + G.Escenario.Centro.X, puntosTemporales[nPuntos - 1].Y + G.Escenario.Centro.Y); Punto aI = new Punto(puntosTemporales[nPuntos - 2].X + G.Escenario.Centro.X, puntosTemporales[nPuntos - 2].Y + G.Escenario.Centro.Y); Poligono pol = new Poligono(aF, Poligono.TipoPoligono.Abierto); pol.Add(aI); G.Pintor.dibujarPoligono(pol);//poligono absoluto dibujando temporales } }