protected override void prepareCtrls()
        {
            base.prepareCtrls();
            InitializeComponent();
            CheckProjectFolder();
            DspWndLayoutManager = new dotNetLab.Vision.DspWndLayout();
            cc :;
            String str = CompactDB.FetchValue("AppName");

            if (str == null)
            {
                CompactDB.Write("AppName", "视觉检测应用");
                goto cc;
            }
            this.Text = str;
            if (-99999 == CompactDB.FetchIntValue("DisplayWndNum"))
            {
                CompactDB.Write("DisplayWndNum", "1");
            }
            DspWndLayoutManager.PrepareDspWnds(typeof(MVDisplay), this.canvasPanel1, CompactDB.FetchIntValue("DisplayWndNum"));

            this.Load += (sender, e) =>
            {
                //必须使用这个方法来最大化窗体
                this.MaxWindow();
            };
            // PrepareVision();
        }
        public void AutoSaveClearImage(HImage bmp, bool isNG)
        {
            //自动保存及清理图片
            //保存
            List <String> lst         = CompactDB.GetNameColumnValues(CompactDB.DefaultTable);
            String        picturePath = "图片";

            if (!Directory.Exists("图片"))
            {
                Directory.CreateDirectory(picturePath);
            }
            //当前图片保存到哪个位置
            String strNowPictureToGo = String.Format("图片\\{0}", DateTime.Now.ToString("yyyy-MM-dd"));

            if (!Directory.Exists(strNowPictureToGo))
            {
                Directory.CreateDirectory(strNowPictureToGo);
            }
            string strNGPictureToGo = String.Format("{0}\\NG", strNowPictureToGo);

            if (!Directory.Exists(strNGPictureToGo))
            {
                Directory.CreateDirectory(strNGPictureToGo);
            }
            string strOKPictureToGo = String.Format("{0}\\OK", strNowPictureToGo);

            if (!Directory.Exists(strOKPictureToGo))
            {
                Directory.CreateDirectory(strOKPictureToGo);
            }

            if (isNG)
            {
                bmp.Save(Path.Combine(strNGPictureToGo, DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss") + ".bmp"));
            }
            else
            {
                bmp.Save(Path.Combine(strOKPictureToGo, DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss") + ".bmp"));
            }


            int      nGapDays           = CompactDB.FetchIntValue("AutoClearTime");
            DateTime dt                 = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(-nGapDays);
            string   deletingFolderName = dt.ToString("yyyy-MM-dd");

            if (!Directory.Exists(Path.Combine(picturePath, deletingFolderName)))
            {
                return;
            }

            string directoryName = Path.Combine(picturePath, deletingFolderName);

            String[] strDirs_OK_NG = Directory.GetDirectories(directoryName);
            //
            for (int j = 0; j < strDirs_OK_NG.Length; j++)
            {
                String[] strFiles = Directory.GetFiles(strDirs_OK_NG[j]);
                for (int i = 0; i < strFiles.Length; i++)
                {
                    File.Delete(strFiles[j]);
                }
            }
            Directory.Delete(directoryName);
        }