コード例 #1
0
        private void BtnMostrarImagen_Click(object sender, EventArgs e)
        {
            BtnMostrarImagen.Text = "Cambiar imagen";

            int N = EscogerNumero(CklLista.Items.Count, ListaRevision, NoRepetir);

            if (N == -1)
            {
                BtnMostrarImagen.Text = "Mostrar imagen";
                MessageBox.Show("No hay elementos en la lista", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (ListaRevision.Count(n => n.Equals(true)) >= CklLista.Items.Count - 1)
            {
                if (ListaRevision.Count == 0)
                {
                    BtnMostrarImagen.Text = "Mostrar imagen";
                    MessageBox.Show("No hay imagenes disponibles para mostrar, añadalas por favor o actualice la lista");
                    return;
                }
                MostrarImagen(N);
                for (int i = 0; i < CklLista.Items.Count; i++)
                {
                    CklLista.SetItemChecked(i, false);//reinicia los checks
                }
                MessageBox.Show($"Todas las imagenes se mostraron");
                BtnMostrarImagen.Text = "Mostrar imagen";
                GenerarLista();//en este limpia la lista de revision
                PicExpositor.BackgroundImage = null;
                imagen.Dispose();
                return;
            }
            MostrarImagen(N);
        }
コード例 #2
0
 private void CklLista_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyValue.Equals(13) && CklLista.SelectionMode == SelectionMode.One && CklLista.GetItemChecked(CklLista.SelectedIndex).Equals(true))
         {
             CklLista.SetItemChecked(CklLista.SelectedIndex, false);
             ListaRevision[CklLista.SelectedIndex] = false;
         }
         else if (e.KeyValue.Equals(13) && CklLista.SelectionMode == SelectionMode.One && CklLista.GetItemChecked(CklLista.SelectedIndex).Equals(false))
         {
             CklLista.SetItemChecked(CklLista.SelectedIndex, true);
             ListaRevision[CklLista.SelectedIndex] = true;
         }
     }
     catch (ArgumentOutOfRangeException) { }
 }
コード例 #3
0
 private void MostrarImagen(int x)
 {
     if (imagen != null)
     {
         PicExpositor.BackgroundImage = null;
         imagen.Dispose();
     }
     try
     {
         imagen = Image.FromFile(path[x]);
         PicExpositor.BackgroundImage = imagen;
         CklLista.SetItemChecked(x, true);
         ListaRevision[x] = true;
     }
     catch (ArgumentOutOfRangeException)
     { MessageBox.Show("imagenes no encontradas"); }
     catch (FileNotFoundException)
     {
         MessageBox.Show("imagenes no encontradas");
     }
 }