예제 #1
0
        private DataGridViewRow CrearFila(SegmentoRectilineo segmento)
        {
            var row = new DataGridViewRow();

            row.CreateCells(dataGridView);

            row.Cells[0].Value = segmento.A.X;
            row.Cells[1].Value = segmento.A.Y;
            row.Cells[2].Value = segmento.B.X;
            row.Cells[3].Value = segmento.B.Y;
            row.Cells[4].Value = segmento.Longitud();
            row.Cells[5].Value = segmento.EsOblicuo() ? "Sí" : "No";
            row.Tag            = segmento;

            return(row);
        }
예제 #2
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (ValidarDatos())
            {
                if (SegmentoAE == null)
                {
                    SegmentoAE = new SegmentoRectilineo()
                    {
                        A = new Punto()
                        {
                            X = (int)numAX.Value,
                            Y = (int)numAY.Value
                        },
                        B = new Punto()
                        {
                            X = (int)numBX.Value,
                            Y = (int)numBY.Value
                        }
                    };

                    if (repositorio.Existe(SegmentoAE))
                    {
                        ShowError("El segmento ya existe en la lista.");
                        return;
                    }
                }
                else
                {
                    SegmentoAE.A.X = (int)numAX.Value;
                    SegmentoAE.A.Y = (int)numAY.Value;
                    SegmentoAE.B.X = (int)numBX.Value;
                    SegmentoAE.B.Y = (int)numBY.Value;
                }

                DialogResult = DialogResult.OK;
            }
        }
예제 #3
0
        public bool Existe(SegmentoRectilineo segmentoAE)
        {
            int result = Lista.IndexOf(segmentoAE);

            return(result != -1);
        }
예제 #4
0
 public void Eliminar(SegmentoRectilineo segmento)
 {
     Lista.Remove(segmento);
 }
예제 #5
0
 public void Agregar(SegmentoRectilineo segmento)
 {
     Lista.Add(segmento);
 }