コード例 #1
0
        ///----------------------------------------------------------
        /// <summary>
        ///     NG画像リストを表示する </summary>
        ///----------------------------------------------------------
        private void GetNgList()
        {
            checkedListBox1.Items.Clear();
            string[] f = System.IO.Directory.GetFiles(_InPath, "*.tif");

            if (f.Length == 0)
            {
                label1.Text = "NG画像はありませんでした";
                return;
            }

            ngf = new clsNG[f.Length];

            int Cnt = 0;

            foreach (string files in System.IO.Directory.GetFiles(_InPath, "*.tif"))
            {
                ngf[Cnt]            = new clsNG();
                ngf[Cnt].ngFileName = files;
                string fn = System.IO.Path.GetFileName(files);
                ngf[Cnt].ngRecDate = fn.Substring(0, 4) + "年" + fn.Substring(4, 2) + "月" + fn.Substring(6, 2) + "日" +
                                     fn.Substring(8, 2) + "時" + fn.Substring(10, 2) + "分" + fn.Substring(12, 2) + "秒";

                checkedListBox1.Items.Add(System.IO.Path.GetFileName(ngf[Cnt].ngRecDate));
                Cnt++;
            }

            label1.Text = "NG画像が" + f.Length.ToString() + "件あります";
        }
コード例 #2
0
ファイル: frmHoldRec.cs プロジェクト: ymgw0867/IWT_OCR
        ///----------------------------------------------------------
        /// <summary>
        ///     サムネイル画像表示 </summary>
        ///----------------------------------------------------------
        private void ShowThumbnail(ListView listView, ImageList imageList, string inPath, ref clsNG [] ngf)
        {
            string imageDir = inPath; // 画像ディレクトリ

            string[] jpgFiles = System.IO.Directory.GetFiles(imageDir, "*.tif");

            int width  = 160;
            int height = 100;

            listView.Items.Clear();
            imageList.Images.Clear();

            imageList.ImageSize     = new Size(width, height);
            listView.LargeImageList = imageList;

            if (jpgFiles.Length == 0)
            {
                return;
            }

            ngf = new clsNG[jpgFiles.Length];

            int Cnt = 0;

            for (int i = 0; i < jpgFiles.Length; i++)
            {
                Image original  = Bitmap.FromFile(jpgFiles[i]);
                Image thumbnail = Utility.CreateThumbnail(original, width, height);

                imageList.Images.Add(thumbnail);
                //listView1.Items.Add(jpgFiles[i], i);
                listView.Items.Add(System.IO.Path.GetFileName(jpgFiles[i]), i);

                original.Dispose();
                thumbnail.Dispose();

                ngf[Cnt]            = new clsNG();
                ngf[Cnt].ngFileName = jpgFiles[i];

                string fn = System.IO.Path.GetFileName(jpgFiles[i]);

                ngf[Cnt].ngRecDate = fn.Substring(0, 4) + "年" + fn.Substring(4, 2) + "月" + fn.Substring(6, 2) + "日" +
                                     fn.Substring(8, 2) + "時" + fn.Substring(10, 2) + "分" + fn.Substring(12, 2) + "秒";
                Cnt++;
            }
        }
コード例 #3
0
        ///----------------------------------------------------------
        /// <summary>
        ///     NG画像リストを表示する </summary>
        ///----------------------------------------------------------
        private void GetNgList()
        {
            checkedListBox1.Items.Clear();
            string[] f = System.IO.Directory.GetFiles(_InPath, "*.tif");

            if (f.Length == 0)
            {
                label2.Text = "NG画像はありませんでした";

                linkLblOn.Enabled  = false;
                linkLblOff.Enabled = false;

                button2.Enabled   = false;
                button5.Enabled   = false;
                btnPrn.Enabled    = false;
                btnDelete.Enabled = false;

                return;
            }

            ngf = new clsNG[f.Length];

            int Cnt = 0;

            foreach (string files in System.IO.Directory.GetFiles(_InPath, "*.tif"))
            {
                ngf[Cnt]            = new clsNG();
                ngf[Cnt].ngFileName = files;
                string fn = System.IO.Path.GetFileName(files);
                ngf[Cnt].ngRecDate = fn.Substring(0, 4) + "年" + fn.Substring(4, 2) + "月" + fn.Substring(6, 2) + "日" +
                                     fn.Substring(8, 2) + "時" + fn.Substring(10, 2) + "分" + fn.Substring(12, 2) + "秒";

                checkedListBox1.Items.Add(System.IO.Path.GetFileName(ngf[Cnt].ngRecDate));
                Cnt++;
            }

            label2.Text = f.Length.ToString() + "件のNG画像があります";

            linkLblOn.Enabled  = true;
            linkLblOff.Enabled = true;

            button2.Enabled   = true;
            button5.Enabled   = true;
            btnPrn.Enabled    = true;
            btnDelete.Enabled = true;
        }
コード例 #4
0
        ///----------------------------------------------------------
        /// <summary>
        ///     サムネイル画像表示 </summary>
        ///----------------------------------------------------------
        private void ShowThumbnail()
        {
            string imageDir = Properties.Settings.Default.ngPath; // 画像ディレクトリ

            string[] jpgFiles = System.IO.Directory.GetFiles(imageDir, "*.tif");

            int width  = 220;
            int height = 100;

            listView1.Items.Clear();
            imageList1.Images.Clear();

            imageList1.ImageSize     = new Size(width, height);
            listView1.LargeImageList = imageList1;

            //string[] f = System.IO.Directory.GetFiles(_InPath, "*.tif");

            if (jpgFiles.Length == 0)
            {
                //label2.Text = "NG画像はありませんでした";

                linkLblOn.Enabled  = false;
                linkLblOff.Enabled = false;

                button2.Enabled   = false;
                btnPrn.Enabled    = false;
                btnDelete.Enabled = false;

                return;
            }

            ngf = new clsNG[jpgFiles.Length];

            int Cnt = 0;

            for (int i = 0; i < jpgFiles.Length; i++)
            {
                Image original  = Bitmap.FromFile(jpgFiles[i]);
                Image thumbnail = Utility.CreateThumbnail(original, width, height);

                imageList1.Images.Add(thumbnail);
                //listView1.Items.Add(jpgFiles[i], i);
                listView1.Items.Add(System.IO.Path.GetFileName(jpgFiles[i]), i);

                original.Dispose();
                thumbnail.Dispose();

                ngf[Cnt]            = new clsNG();
                ngf[Cnt].ngFileName = jpgFiles[i];

                string fn = System.IO.Path.GetFileName(jpgFiles[i]);

                ngf[Cnt].ngRecDate = fn.Substring(0, 4) + "年" + fn.Substring(4, 2) + "月" + fn.Substring(6, 2) + "日" +
                                     fn.Substring(8, 2) + "時" + fn.Substring(10, 2) + "分" + fn.Substring(12, 2) + "秒";
                Cnt++;
            }

            //label2.Text = f.Length.ToString() + "件のNG画像があります";

            linkLblOn.Enabled  = true;
            linkLblOff.Enabled = true;

            button2.Enabled   = true;
            btnPrn.Enabled    = true;
            btnDelete.Enabled = true;
        }