private void Form1_Load(object sender, EventArgs e)
 {
     try
     {
         //get list of devices available
         List <string> devices = WIAScanner.GetDevices();
         foreach (string device in devices)
         {
             comboBox1.Items.Add(device);
         }
         //check if device is not available
         if (comboBox1.Items.Count == 0)
         {
             MessageBox.Show("You do not have any WIA devices.");
             this.Close();
         }
         else
         {
             comboBox1.SelectedIndex = 0;
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
Beispiel #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     try
     {
         //get list of devices available
         List <string> devices = WIAScanner.GetDevices();
         foreach (string device in devices)
         {
             comboBox1.Items.Add(device);
         }
         //check if device is not available
         if (comboBox1.Items.Count == 0)
         {
             MessageBox.Show("No Compatible WIA Device Found", "DEVICE UNPLUGGED", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             this.Close();
         }
         else
         {
             comboBox1.SelectedIndex = 0;
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
Beispiel #3
0
 private void FrmGetPicture_Load(object sender, EventArgs e)
 {
     _cameraChoice.UpdateDeviceList();
     foreach (var item in _cameraChoice.Devices)
     {
         cboCameraList.Items.Add(item.Name);
     }
     if (cboCameraList.Items.Count > 0)
     {
         cboCameraList.SelectedIndex = 0;
     }
     try
     {
         List <string> devices = WIAScanner.GetDevices();
         foreach (var item in devices)
         {
             cboScanner.Items.Add(item);
         }
         if (cboScanner.Items.Count > 0)
         {
             cboScanner.SelectedIndex = 0;
         }
     }
     catch (Exception ex)
     {
         WinInfoHelper.ShowInfoWindow(this, "扫描仪设备加载失败!" + ex.Message);
         log.Error("扫描仪设备加载失败:", ex);
     }
 }
        private void button5_Click(object sender, EventArgs e)
        {
            List <Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem);

            foreach (Image image in images)
            {
                pictureBox2.Image = rotate(image);
            }
        }
Beispiel #5
0
        private void button5_Click(object sender, EventArgs e)
        {
            List <System.Drawing.Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem, 100, type);

            foreach (System.Drawing.Image image in images)
            {
                pictureBox2.Image = rotate(image);
                pictureBox1.Image = image;
            }
        }
Beispiel #6
0
//button click event
        private void btn_scan_Click(object sender, EventArgs e)
        {
            try
            {
                //get list of devices available
                List <string> devices = WIAScanner.GetDevices();

                foreach (string device in devices)
                {
                    lbDevices.Items.Add(device);
                }
                //check if device is not available
                if (lbDevices.Items.Count == 0)
                {
                    MessageBox.Show("You do not have any WIA devices.");
                    DialogResult dr = MessageBox.Show("Would you like to Capture Screen?", "Alert", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.Yes)
                    {
                        CaptureScrn();
                        loadSetting();
                        return;
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
                else
                {
                    lbDevices.SelectedIndex = 0;
                }
                //get images from scanner
                List <Image> images = WIAScanner.Scan((string)lbDevices.SelectedItem);
                foreach (Image image in images)
                {
                    pic_scan.Image = image;
                    ImageScanned   = image;
                    pic_scan.Show();
                    pic_scan.SizeMode = PictureBoxSizeMode.StretchImage;
                    //save scanned image into specific folder
                    // image.Save(@"D:\" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".jpeg", ImageFormat.Jpeg);
                }
                loadSetting();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Beispiel #7
0
        public MainForm()
        {
            InitializeComponent();

            string s = WIAScanner.SelectDevice();
            int    i = 0;

            List <string> pages = WIAScanner.Scan(s);

            foreach (string fn in pages)
            {
                string outFileName = string.Format(@"E:\{0}.jpg", i++);
                Image.FromFile(fn).Save(outFileName, ImageFormat.Jpeg);
            }
        }
Beispiel #8
0
 public string Scan(string deviceId)
 {
     try
     {
         ScanSettings settings = new ScanSettings();
         settings.DeviceId = deviceId;
         var image = WIAScanner.Scan(settings);
         return(image.First());
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         Debug.WriteLine(String.Format("Device Id is {0}", deviceId));
         return("Error: " + ex.Message);
     }
 }
Beispiel #9
0
        public string ScanDefault()
        {
            var devices = this.GetDevices();

            try
            {
                ScanSettings settings = new ScanSettings();
                settings.DeviceId = devices.FirstOrDefault().DeviceId;
                var images = WIAScanner.Scan(settings);
                return(images.First());
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return("Error: " + ex.Message);
            }
        }
Beispiel #10
0
 public string ScanWithSettings(int intent, string deviceId)
 {
     try
     {
         StatusVariables.Path = "";
         ScanSettings settings = new ScanSettings();
         settings.DeviceId   = deviceId;
         settings.WIA_Intent = intent;
         var image = WIAScanner.Scan(settings);
         return(image.First());
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         return("Error: " + ex.Message);
     }
 }
Beispiel #11
0
        //button click event

        private void btn_scan_Click(object sender, EventArgs e)
        {
            try
            {
                //get list of devices available
                List <string> devices = WIAScanner.GetDevices();

                foreach (string device in devices)
                {
                    lbDevices.Items.Add(device);
                }
                //check if device is not available
                if (lbDevices.Items.Count == 0)
                {
                    MessageBox.Show("WIA aracı bulunamadı");
                    this.Close();
                }
                else
                {
                    lbDevices.SelectedIndex = 0;
                }
                //tarayıcı trafından resimi alma
                List <Image> images = WIAScanner.Scan((string)lbDevices.SelectedItem);
                foreach (Image image in images)
                {
                    pic_scan.Image = image;
                    image1         = image;
                    pic_scan.Show();
                    pic_scan.SizeMode = PictureBoxSizeMode.StretchImage;
                    //resmi d deki dizine kaydetme
                    // image.Save(@"C:\Users\Halil\Desktop\Scannerapplication\Scannerapplication\TarananDosyalar" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".jpeg", ImageFormat.Jpeg);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }

            btnKaydet.Visible = true;
            // btnSil.Visible = true;
            //btnYenidenTara.Visible = true;
        }
Beispiel #12
0
 //button click event
 private void btn_scan_Click(object sender, EventArgs e)
 {
     try
     {
         //get images from scanner
         // List<Image> images = WIAScanner.Scan(((string)lbDevices.SelectedItem).Split('|')[1]);
         List <Image> images = WIAScanner.Scan();
         foreach (Image image in images)
         {
             pic_scan.Image     = image;
             pic_scan.BackColor = Color.Transparent;
             pic_scan.Show();
             pic_scan.SizeMode = PictureBoxSizeMode.StretchImage;
             cansaveImage      = true;
             //save scanned image into specific folder
             //  image.Save(@"D:\" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".jpeg", ImageFormat.Jpeg);
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
Beispiel #13
0
        public Form1(string[] args)
        {
            InitializeComponent();
            SetAllControlsFont(Controls);
            cansaveImage = false;
            if (args.Length >= 1)
            {
                textBox1.Text = args[0];
            }
            if (args.Length > 1)
            {
                textBox2.Text = args[1];
            }
            try
            {
                //get list of devices available
                List <string> devices = WIAScanner.GetDevices();

                foreach (string device in devices)
                {
                    lbDevices.Items.Add(device);
                }
                //check if device is not available
                if (lbDevices.Items.Count == 0)
                {
                    MessageBox.Show("Você não possui nenhum scanner instalado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    lbDevices.SelectedIndex = 0;
                }
            }
            catch
            {
            }
        }
Beispiel #14
0
        private void btnStartScanning_Click(object sender, RoutedEventArgs e)
        {
            if (SelectedScanType == null)
            {
                MainWindow.ErrorMessage = (string)Application.Current.FindResource("MorasOdabratiVrstuSkeniranjaUzvicnik");
                return;
            }

            CanInteractWithForm = false;


            Thread td = new Thread(() =>
            {
                try
                {
                    var scanner = new WIAScanner();
                    scanner.InitializeProperties(new Dictionary <WIAScanner.WiaProperty, dynamic>()
                    {
                        { WiaProperty.DataType, (uint)SelectedScanType.Type },
                    });

                    List <string> scannedData = new List <string>();
                    try
                    {
                        //int i = 0;
                        //while(i++ < 10)
                        //{

                        //}
                        scannedData.Clear();
                        scanner.Scan(SelectedDocumentHandlingType.Type.Value, SelectedDocumentScanMode.Type, scannedData);

                        if (scannedData != null && scannedData.Count() > 0)
                        {
                            var images = Images.ToList();
                            foreach (var item in scannedData)
                            {
                                images.Add(new ScannedImageViewModel()
                                {
                                    Identifier = Guid.NewGuid(),
                                    ImagePath  = item,
                                    IsSelected = false,
                                    CreatedAt  = DateTime.Now,
                                });
                            }
                            Images = new ObservableCollection <ScannedImageViewModel>(images.OrderBy(x => x.UpdatedAt));
                        }
                        else
                        {
                            MainWindow.ErrorMessage = (string)Application.Current.FindResource("UbaciPapirUSkenerUzvicnik");
                        }
                    } catch (WiaScannerInsertPaperException exc)
                    {
                        MainWindow.ErrorMessage = (string)Application.Current.FindResource("UbaciPapirUSkenerUzvicnik");
                    }
                }
                catch (WiaScannerDeviceNotFoundException exc)
                {
                    MainWindow.ErrorMessage = exc.Message;
                }
                catch (IOException exc)
                {
                    throw exc;
                }
                catch (WiaScannerInsertPaperException exc)
                {
                    MainWindow.ErrorMessage = (string)Application.Current.FindResource("UbaciPapirUSkenerUzvicnik");
                }
                catch (COMException ex)
                {
                    if ((uint)ex.ErrorCode == 0x80210003)
                    {
                        MainWindow.ErrorMessage = (string)Application.Current.FindResource("UbaciPapirUSkenerUzvicnik");
                    }
                    else
                    {
                        MainWindow.ErrorMessage = (string)Application.Current.FindResource("GreskaPriUcitavanjuSkeneraProbajOpetUzvicnik");
                    }
                }
                catch (Exception ex)
                {
                    if (ex.GetType() != typeof(COMException))
                    {
                        MainWindow.ErrorMessage = ex.Message;
                    }
                    else
                    {
                        MainWindow.ErrorMessage = (string)Application.Current.FindResource("GreskaPriUcitavanjuSkeneraProbajOpetUzvicnik");
                    }
                } finally
                {
                    CanInteractWithForm = true;
                }
            });

            td.IsBackground = true;
            td.Start();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     button1.Enabled = false;
     try
     {
         if (textBox1.Text.Length == 0)
         {
             //get images from scanner
             List <Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem);
             foreach (Image image in images)
             {
                 pictureBox1.Image = image;
                 //save scanned image into specific folder
                 image.Save(textBox3.Text + "\\" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".jpeg", ImageFormat.Jpeg);
             }
         }
         else
         {
             //If Document Name not Empty
             if (radioButton1.Checked)
             {
                 //For Unlimited Option
                 //For MultiScan
                 int temp = 0;
                 if (Directory.Exists(textBox3.Text + "\\" + textBox1.Text))
                 {
                     int count = 0;
                     while (Directory.Exists(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")"))
                     {
                         count++;
                     }
                     Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")");
                 }
                 else
                 {
                     Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text);
                 }
                 while (true)
                 {
                     ConfirmingDialogBox cdb = new ConfirmingDialogBox();
                     cdb.currentpage = temp + 1;
                     cdb.maxpage     = 0;
                     cdb.ShowDialog();
                     if (cdb.status == 1)
                     {
                         List <Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem);
                         foreach (Image image in images)
                         {
                             rotate(image);
                             pictureBox1.Image = image;
                             //save scanned image into specific folder
                             image.Save(textBox3.Text + "\\" + textBox1.Text + "\\" + temp + ".jpeg", ImageFormat.Jpeg);
                             temp++;
                         }
                     }
                     else
                     {
                         break;
                     }
                 }
             }
             else if (int.Parse(textBox2.Text) > 0)
             {
                 int n = int.Parse(textBox2.Text);
                 if (n == 1)
                 {
                     List <Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem);
                     foreach (Image image in images)
                     {
                         pictureBox1.Image = image;
                         //save scanned image into specific folder
                         if (File.Exists(textBox3.Text + "\\" + textBox1.Text + ".jpeg"))
                         {
                             int temp = 0;
                             while (File.Exists(textBox3.Text + "\\" + textBox1.Text + " (" + temp + ").jpeg"))
                             {
                                 temp++;
                             }
                             image.Save(textBox3.Text + "\\" + textBox1.Text + "(" + temp + ").jpeg", ImageFormat.Jpeg);
                         }
                         else
                         {
                             image.Save(textBox3.Text + "\\" + textBox1.Text + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".jpeg", ImageFormat.Jpeg);
                         }
                     }
                 }
                 else
                 {
                     //For MultiScan
                     int temp = 0;
                     if (Directory.Exists(textBox3.Text + "\\" + textBox1.Text))
                     {
                         int count = 0;
                         while (Directory.Exists(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")"))
                         {
                             count++;
                         }
                         Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")");
                     }
                     else
                     {
                         Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text);
                     }
                     for (int i = 0; i < int.Parse(textBox2.Text); i++)
                     {
                         ConfirmingDialogBox cdb = new ConfirmingDialogBox();
                         cdb.maxpage     = int.Parse(textBox2.Text);
                         cdb.currentpage = i + 1;
                         cdb.ShowDialog();
                         if (cdb.status == 1)
                         {
                             List <Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem);
                             foreach (Image image in images)
                             {
                                 rotate(image);
                                 pictureBox1.Image = image;
                                 //save scanned image into specific folder
                                 image.Save(textBox3.Text + "\\" + textBox1.Text + "\\" + temp + ".jpeg", ImageFormat.Jpeg);
                                 temp++;
                             }
                         }
                         else
                         {
                             break;
                         }
                     }
                 }
             }
             else
             {
                 MessageBox.Show("Please enter the number of pages you wish to scan in the dedicated Textbox.", "PARAMETER MISSING", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
     button1.Enabled = true;
 }
Beispiel #16
0
 private void button1_Click(object sender, EventArgs e)
 {
     button1.Enabled = false;
     try
     {
         if (textBox1.Text.Length == 0)
         {
             //get images from scanner
             List <System.Drawing.Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem, resolution, type);
             foreach (System.Drawing.Image image in images)
             {
                 pictureBox1.Image = image;
                 //save scanned image into specific folder
                 saveImage(image, textBox3.Text + "\\" + DateTime.Now.ToString("yyyy-MM-dd HHmmss"));
                 textBox1.Text = DateTime.Now.ToString("yyyy-MM-dd HHmmss");
             }
         }
         else
         {
             //If Document Name not Empty
             if (radioButton1.Checked)
             {
                 //For Unlimited Option
                 //For MultiScan
                 int    temp     = 0;
                 int    count    = 0;
                 String overHead = "";
                 if (Directory.Exists(textBox3.Text + "\\" + textBox1.Text))
                 {
                     while (Directory.Exists(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")"))
                     {
                         count++;
                     }
                     Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")");
                     overHead = " (" + count + ")";
                 }
                 else
                 {
                     Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text);
                 }
                 String directorySavePath = textBox3.Text + "\\" + textBox1.Text + overHead + "\\";
                 while (true)
                 {
                     ConfirmingDialogBox cdb = new ConfirmingDialogBox();
                     cdb.currentpage = temp + 1;
                     cdb.maxpage     = 0;
                     cdb.ShowDialog();
                     if (cdb.status == 1)
                     {
                         try
                         {
                             List <System.Drawing.Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem, resolution, type);
                             foreach (System.Drawing.Image image in images)
                             {
                                 rotate(image);
                                 pictureBox1.Image = image;
                                 //save scanned image into specific folder
                                 saveImage(image, directorySavePath + temp);
                                 temp++;
                             }
                         }
                         catch (Exception e1)
                         {
                             DialogResult dr = MessageBox.Show("Unfortunately, the software has encountered the following Error : " + e1.Message, "SCANNING ERROR", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
                             if (dr == DialogResult.Ignore)
                             {
                                 temp++;
                             }
                             else if (dr == DialogResult.Abort)
                             {
                                 break;
                             }
                         }
                     }
                     else
                     {
                         break;
                     }
                 }
             }
             else if (int.Parse(textBox2.Text) > 0)
             {
                 int n = int.Parse(textBox2.Text);
                 if (n == 1)
                 {
                     List <System.Drawing.Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem, resolution, type);
                     foreach (System.Drawing.Image image in images)
                     {
                         pictureBox1.Image = image;
                         //save scanned image into specific folder
                         if (File.Exists(textBox3.Text + "\\" + textBox1.Text + ".jpeg"))
                         {
                             int temp = 0;
                             while (File.Exists(textBox3.Text + "\\" + textBox1.Text + " (" + temp + ").jpeg"))
                             {
                                 temp++;
                             }
                             saveImage(image, textBox3.Text + "\\" + textBox1.Text + "(" + temp + ")");
                         }
                         else
                         {
                             saveImage(image, textBox3.Text + "\\" + textBox1.Text + DateTime.Now.ToString("yyyy-MM-dd HHmmss"));
                         }
                     }
                 }
                 else
                 {
                     //For MultiScan
                     int    temp     = 0;
                     int    count    = 0;
                     String overHead = "";
                     if (Directory.Exists(textBox3.Text + "\\" + textBox1.Text))
                     {
                         while (Directory.Exists(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")"))
                         {
                             count++;
                         }
                         Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text + " (" + count + ")");
                         overHead = " (" + count + ")";
                     }
                     else
                     {
                         Directory.CreateDirectory(textBox3.Text + "\\" + textBox1.Text);
                     }
                     String directorySavePath = textBox3.Text + "\\" + textBox1.Text + overHead + "\\";
                     for (int i = 0; i < int.Parse(textBox2.Text); i++)
                     {
                         ConfirmingDialogBox cdb = new ConfirmingDialogBox();
                         cdb.maxpage     = int.Parse(textBox2.Text);
                         cdb.currentpage = i + 1;
                         cdb.ShowDialog();
                         if (cdb.status == 1)
                         {
                             List <System.Drawing.Image> images = WIAScanner.Scan((string)comboBox1.SelectedItem, resolution, type);
                             foreach (System.Drawing.Image image in images)
                             {
                                 rotate(image);
                                 pictureBox1.Image = image;
                                 //save scanned image into specific folder
                                 saveImage(image, directorySavePath + temp);
                                 temp++;
                             }
                         }
                         else
                         {
                             break;
                         }
                     }
                 }
             }
             else
             {
                 MessageBox.Show("Please enter the number of pages you wish to scan in the dedicated Textbox.", "PARAMETER MISSING", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
     pdfIfRequired();
     button1.Enabled = true;
 }
        private void btnTara_Click(object sender, EventArgs e)
        {
            klasorTC    = txtTcNo.Text;
            klasorBolum = txtBolum.Text;
            klasorTarih = dtpTarih.Value.ToString("yyyy-MM-dd");

            var selectedNode = tvKayit.SelectedNode;

            if (tvKayit.SelectedNode.Tag != null)
            {
                if (tvKayit.SelectedNode.Tag.ToString() != "Rapor")
                {
                    MessageBox.Show(@"Rapor Bilgisi Seçiniz !");
                    return;
                }
            }
            else
            {
                MessageBox.Show(@"Rapor Bilgisi Seçiniz !");
                return;
            }
            if (selectedNode.Parent.Text == "Hasta Muayene ve Ekipriz")
            {
                if (File.Exists(@"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\epikrizResim"))
                {
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\epikrizResim\\";
                }
                else
                {
                    String path = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\epikrizResim\\";
                    //yyyy-MM-dd HH-mm-ss
                    if (!File.Exists(path))
                    {
                        System.IO.Directory.CreateDirectory(path);
                    }
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\epikrizResim\\";
                }
            }
            else if (selectedNode.Parent.Text == "Tetkik ve Raporlar")
            {
                if (File.Exists(@"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\tetkikRapor"))
                {
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\tetkikRapor\\";
                }
                else
                {
                    Directory.CreateDirectory(@"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\tetkikRapor");
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\tetkikRapor\\";
                }
            }
            else if (selectedNode.Text == "Adli ve Sağlık Kurulu")
            {
                if (File.Exists(@"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\adliSaglik"))
                {
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\adliSaglik\\";
                }
                else
                {
                    Directory.CreateDirectory(@"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\adliSaglik");
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\adliSaglik\\";
                }
            }
            else if (selectedNode.Text == "Diğer")
            {
                if (File.Exists(@"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\Diğer"))
                {
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\Diğer\\";
                }
                else
                {
                    Directory.CreateDirectory(@"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\Diğer");
                    resimYolu = @"D:\" + klasorTC + "\\" + klasorBolum + "\\" + klasorTarih + "\\Diğer\\";
                }
            }
            try
            {
                var deneme = "";
                foreach (var device in WIAScanner.GetDevices())
                {
                    deneme = device;
                }

                var images = WIAScanner.Scan(deneme);
                foreach (var image in images)
                {
                    var pb = new PictureBox
                    {
                        Name     = "pb" + _i,
                        Size     = new Size(70, 50),
                        SizeMode = PictureBoxSizeMode.StretchImage,
                        Image    = image
                    };


                    pb.Click += new EventHandler(pb_Click);
                    pb.Tag    = tvKayit.SelectedNode.Text;
                    _tumResimler.Add(new Resimler(_i, tvKayit.SelectedNode.Text, pb.Name, pb.Image)); // resimId, raporAd, resimAd, resim.
                    flpResimler.Controls.Add(pb);
                    image1 = pb.Image;
                    _i++;
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Beispiel #18
0
        private void biScan_Click(object sender, EventArgs e)
        {
            if (cboScanner.SelectedItem == null)
            {
                MessageBox.Show("未选择扫描仪!");
                return;
            }
            List <Image> images = WIAScanner.Scan((string)cboScanner.SelectedItem);

            if (images.Count > 0)
            {
                for (int i = 0; i < images.Count; i++)
                {
                    if (i == 0)
                    {
                        if (picBox1.Image != null)
                        {
                            picBox1.Image.Dispose();
                            picBox1.Image = null;
                        }
                        picBox1.Image = images[i];
                        if (picImage.Image != null)
                        {
                            picImage.Image.Dispose();
                            picImage.Image = null;
                        }
                        picImage.Image = (Image)images[i].Clone();
                        HasChanged     = true;
                    }
                    else if (i == 1)
                    {
                        if (picBox2.Image != null)
                        {
                            picBox2.Image.Dispose();
                            picBox2.Image = null;
                        }
                        picBox2.Image = images[i];
                    }
                    else if (i == 2)
                    {
                        if (picBox3.Image != null)
                        {
                            picBox3.Image.Dispose();
                            picBox3.Image = null;
                        }
                        picBox3.Image = images[i];
                    }
                    else if (i == 3)
                    {
                        if (picBox4.Image != null)
                        {
                            picBox4.Image.Dispose();
                            picBox4.Image = null;
                        }
                        picBox4.Image = images[i];
                    }
                    else if (i == 4)
                    {
                        if (picBox5.Image != null)
                        {
                            picBox5.Image.Dispose();
                            picBox5.Image = null;
                        }
                        picBox5.Image = images[i];
                    }
                }
                for (int i = 5; i < images.Count; i++)
                {
                    Image image = images[i];
                    images.Remove(image);
                    image.Dispose();
                }
            }
        }
Beispiel #19
0
 public List <ScannerDevice> GetDevices()
 {
     return(WIAScanner.GetDevices());
 }