private void BotonCapturarImagen_Click(object sender, EventArgs e) { #if WINDOWS try { WIA.CommonDialogClass WiaDialog = new WIA.CommonDialogClass(); WIA.ImageFile WiaImage = null; WiaImage = WiaDialog.ShowAcquireImage( WIA.WiaDeviceType.UnspecifiedDeviceType, WIA.WiaImageIntent.ColorIntent, WIA.WiaImageBias.MaximizeQuality, System.Drawing.Imaging.ImageFormat.Jpeg.Guid.ToString("B"), true, false, false); if (WiaImage != null) { WIA.Vector vector = WiaImage.FileData; using (Entrada.AuxForms.ImagenRecorte Recorte = new Entrada.AuxForms.ImagenRecorte()) { Recorte.Imagen = System.Drawing.Image.FromStream(new System.IO.MemoryStream((byte[])vector.get_BinaryData())); if (Recorte.ShowDialog() == System.Windows.Forms.DialogResult.OK) { EntradaImagen.Image = Recorte.Imagen; this.Changed = true; this.ActualizarElemento(); } } } } catch (Exception ex) { Lui.Forms.MessageBox.Show("No se puede conectar con el dispositivo de captura. " + ex.Message, "Error"); } #endif }
private void BotonCapturarImagen_Click(object sender, EventArgs e) { #if WINDOWS try { WIA.CommonDialogClass WiaDialog = new WIA.CommonDialogClass(); WIA.ImageFile WiaImage = null; WiaImage = WiaDialog.ShowAcquireImage( WIA.WiaDeviceType.UnspecifiedDeviceType, WIA.WiaImageIntent.ColorIntent, WIA.WiaImageBias.MaximizeQuality, System.Drawing.Imaging.ImageFormat.Jpeg.Guid.ToString("B"), true, false, false); if (WiaImage != null) { WIA.Vector vector = WiaImage.FileData; using (Entrada.AuxForms.ImagenRecorte Recorte = new Entrada.AuxForms.ImagenRecorte()) { Recorte.Imagen = System.Drawing.Image.FromStream(new System.IO.MemoryStream((byte[])vector.get_BinaryData())); if (Recorte.ShowDialog() == System.Windows.Forms.DialogResult.OK) { EntradaImagen.Image = Recorte.Imagen; this.Changed = true; this.ActualizarElemento(); } } } } catch (Exception ex) { Lui.Forms.MessageBox.Show("No se puede conectar con el dispositivo de captura. " + ex.Message, "Error"); } #endif }