Пример #1
0
 private void FormEmoji_Load(object sender, EventArgs e)
 {
     this.pictureBox1.ClientSize = new Size(this.img.GetAncho(), this.img.GetAlto());
     this.bmp = this.img.ConvertirPPMaBMP();
     this.SetSize(this.img.GetAncho() + 50, this.img.GetAlto() + 50);
     this.pictureBox1.Image = (Image)this.bmp;
     this.CenterToScreen();
     this.label1.Text = "Haga clic en la imagen donde quiera que haya el emoji";
     emojiImg.CargarBMP("emoji1.png");
     emojiBMP = emojiImg.ConvertirPPMaBMP();
     this.pictureBox1.Image = (Image)this.bmp;
     this.hecho             = false;
 }
Пример #2
0
        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            Imagen img;
            int    loadResult;
            String url       = openFileDialog1.FileName;
            String name      = Path.GetFileName(url);
            String extension = Path.GetExtension(url);

            if (extension != ".ppm" && extension != ".png" && extension != ".jpg")
            {
                MessageBox.Show("Error: Extensión inválida.");
                return;
            }

            img = new Imagen(url);
            if (extension == ".ppm")
            {
                loadResult = img.CargarPPM();
            }
            else
            {
                loadResult = img.CargarBMP(url);
            }
            if (loadResult == -1)
            {
                MessageBox.Show("Error: Archivo no encontrado.");
                return;
            }
            else if (loadResult == -2)
            {
                MessageBox.Show("Error: Archivo no encontrado.");
                return;
            }

            this.bmp = img.ConvertirPPMaBMP();
            getNextPictureBox().Image    = (Image)bmp;
            getNextPictureBox().SizeMode = PictureBoxSizeMode.StretchImage;
            imagenesCargadas++;

            if (imagenesCargadas != 9)
            {
                label2.Text = "Faltan " + (9 - imagenesCargadas) + " imágenes por seleccionar";
                return;
            }

            this.button1.Enabled = false;
            this.button1.Visible = false;
            this.label2.Visible  = false;

            this.botonGuardar.Visible = true;
        }