Example #1
0
        private void miPanel_Paint(object sender, PaintEventArgs e)
        {
            if (pintar)
            {
                Graphics graficos = miPanel.CreateGraphics();
                graficos.DrawLine(new Pen(Color.Red), new Point(Convert.ToInt32(miPlan1.GetIX()), Convert.ToInt32(miPlan1.GetIY())), new Point(Convert.ToInt32(miPlan1.GetFX()), Convert.ToInt32(miPlan1.GetFY())));
                graficos.DrawLine(new Pen(Color.Green), new Point(Convert.ToInt32(miPlan1.Getposix()), Convert.ToInt32(miPlan1.Getposiy())), new Point(Convert.ToInt32(miPlan1.GetIX()), Convert.ToInt32(miPlan1.GetIY())));

                graficos.DrawLine(new Pen(Color.Red), new Point(Convert.ToInt32(miPlan2.GetIX()), Convert.ToInt32(miPlan2.GetIY())), new Point(Convert.ToInt32(miPlan2.GetFX()), Convert.ToInt32(miPlan2.GetFY())));
                graficos.DrawLine(new Pen(Color.Green), new Point(Convert.ToInt32(miPlan2.Getposix()), Convert.ToInt32(miPlan2.Getposiy())), new Point(Convert.ToInt32(miPlan2.GetIX()), Convert.ToInt32(miPlan2.GetIY())));

                if (miPlan1.Distance(miPlan2) < distSeg)
                {
                    Point esquina11 = new Point(Convert.ToInt32(miPlan1.GetIX() - distSeg / 2), Convert.ToInt32(miPlan1.GetIY() - distSeg / 2));
                    Size  tamaño11  = new Size(Convert.ToInt32(distSeg), Convert.ToInt32(distSeg));
                    graficos.FillEllipse(new SolidBrush(Color.Red), new Rectangle(esquina11, tamaño11));

                    Point esquina22 = new Point(Convert.ToInt32(miPlan2.GetIX() - distSeg / 2), Convert.ToInt32(miPlan2.GetIY() - distSeg / 2));
                    Size  tamaño22  = new Size(Convert.ToInt32(distSeg), Convert.ToInt32(distSeg));
                    graficos.FillEllipse(new SolidBrush(Color.Red), new Rectangle(esquina22, tamaño22));
                }
                else
                {
                    Point esquina = new Point(Convert.ToInt32(miPlan1.GetIX() - distSeg / 2), Convert.ToInt32(miPlan1.GetIY() - distSeg / 2));
                    Size  tamaño  = new Size(Convert.ToInt32(distSeg), Convert.ToInt32(distSeg));
                    graficos.DrawEllipse(new Pen(Color.Red), new Rectangle(esquina, tamaño));

                    Point esquina2 = new Point(Convert.ToInt32(miPlan2.GetIX() - distSeg / 2), Convert.ToInt32(miPlan2.GetIY() - distSeg / 2));
                    Size  tamaño2  = new Size(Convert.ToInt32(distSeg), Convert.ToInt32(distSeg));
                    graficos.DrawEllipse(new Pen(Color.Red), new Rectangle(esquina2, tamaño2));
                }

                graficos.Dispose();
            }
        }
        private void MostrarTodosForm_Load(object sender, EventArgs e)
        {
            vuelosGrid.ColumnCount           = 5;
            vuelosGrid.RowHeadersVisible     = false;
            vuelosGrid.Columns[0].HeaderText = "ID";
            vuelosGrid.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            vuelosGrid.Columns[1].HeaderText = "Actual X";
            vuelosGrid.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            vuelosGrid.Columns[2].HeaderText = "Actual Y";
            vuelosGrid.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            vuelosGrid.Columns[3].HeaderText = "Velocidad";
            vuelosGrid.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            vuelosGrid.Columns[4].HeaderText = "Distancia";
            vuelosGrid.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            vuelosGrid.Rows.Add(miPlan1.GetID(), miPlan1.GetIX(), miPlan1.GetIY(), miPlan1.GetVelocidad(), miPlan1.Distance(miPlan2));
            vuelosGrid.Rows.Add(miPlan2.GetID(), miPlan2.GetIX(), miPlan1.GetIY(), miPlan2.GetVelocidad(), miPlan2.Distance(miPlan1));

            vuelosGrid.ClearSelection();
        }