Esempio n. 1
0
        public void PnlMouseUp(object sender, EventArgs e)
        {
            Panel pan = sender as Panel;

            Console.WriteLine("Re-Dibujado1");
            if (!this.pnlMvd)
            {
                Console.WriteLine("Re-Dibujado2");
                foreach (Figura_Relacion rel in Formas.Formas.OfType <Figura_Relacion>())
                {
                    if (rel.isFull)
                    {
                        if (rel.RelIni.Name == pan.Name)
                        {
                            rel.RelIni       = pan;
                            rel.RelPuntos[0] = new Point(rel.RelIni.Location.X + rel.RelIni.Size.Width / 2, rel.RelIni.Location.Y + rel.RelIni.Size.Height / 2);
                        }
                        else if (rel.RelFin.Name == pan.Name)
                        {
                            rel.RelFin       = pan;
                            rel.RelPuntos[1] = new Point(rel.RelFin.Location.X + rel.RelFin.Size.Width / 2, rel.RelFin.Location.Y + rel.RelFin.Size.Height / 2);
                        }
                        Formas.Dibujar();
                        masterPanel.BackgroundImage = Image.FromFile(Formas.GetNewBackground());
                    }
                }

                Console.WriteLine("Re-Dibujado2");
            }
        }
Esempio n. 2
0
        public void PointForRelation(object sender, EventArgs e)//cuando drawing esta activado carga las posiciones de los paneles al una lista
        {
            Panel           pan   = sender as Panel;
            Graphics        g     = this.CreateGraphics();
            Pen             lapiz = new Pen(Color.Black, 3);
            Figura_Relacion rel;

            if (drawing)
            {
                rel = relaciones.Last();
                if (!rel.isFull)
                {
                    if (rel.RelIni == null)
                    {
                        rel.RelIni = pan;
                    }
                    else if (rel.RelIni != null && rel.RelFin == null)
                    {
                        rel.RelFin = pan;
                        rel.isFull = true;
                        rel.RelPuntos.Add(new Point(rel.RelIni.Location.X + rel.RelIni.Size.Width / 2, rel.RelIni.Location.Y + rel.RelIni.Size.Height / 2));
                        rel.RelPuntos.Add(new Point(rel.RelFin.Location.X + rel.RelFin.Size.Width / 2, rel.RelFin.Location.Y + rel.RelFin.Size.Height / 2));
                    }
                }

                if (rel.isFull)
                {
                    Formas.Formas.Add(rel);
                    Formas.CanvasSize = masterPanel.Size;
                    Formas.Dibujar();
                    try
                    {
                        //masterPanel.BackgroundImage = Image.FromFile(@"C:\Users\Andres\Dropbox\6toSemestre\AppAmbProp\Examples\PropietariosMov\PropietariosMovDib4\ProyectoPropietarios\ProyectoPropietarios\Reltst1.bmp");
                        masterPanel.BackgroundImage = Image.FromFile(Formas.GetNewBackground());
                    }
                    catch { }
                    drawing = false;
                }
            }
        }