private void comboxgetrules()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(@"xyrule.xml");
            XmlNodeList no        = doc.SelectSingleNode("//Rules").ChildNodes;
            ArrayList   arrayList = new ArrayList();

            foreach (XmlElement node in no)
            {
                string[]  stringarray = null;
                XYrulescs xYrulescs   = new XYrulescs();
                xYrulescs.Name      = node.GetElementsByTagName("name")[0].InnerText;
                stringarray         = node.GetElementsByTagName("leftup")[0].InnerText.Split(',');
                xYrulescs.Leftup    = new Point(Int32.Parse(stringarray[0]), Int32.Parse(stringarray[1]));
                stringarray         = node.GetElementsByTagName("rightdown")[0].InnerText.Split(',');
                xYrulescs.Rightdown = new Point(Int32.Parse(stringarray[0]), Int32.Parse(stringarray[1]));
                xYrulescs.Xmove     = Int32.Parse(node.GetElementsByTagName("xmove")[0].InnerText);
                xYrulescs.Ymove     = Int32.Parse(node.GetElementsByTagName("ymove")[0].InnerText);
                arrayList.Add(new DictionaryEntry(node.GetElementsByTagName("name")[0].InnerText, xYrulescs));
            }
            if (arrayList.Count > 0)
            {
                fuckType.DataSource    = arrayList;
                fuckType.DisplayMember = "Key";
                fuckType.ValueMember   = "Value";
            }
            else
            {
                ArrayList list = new ArrayList();
                list.Add("请添加新的拍摄方案");
                fuckType.DataSource = list;
            }
        }
        private void btnFuckStart_Click(object sender, EventArgs e)
        {
            fuckSaveNum   = 0;
            fuckDetectNum = 0;
            nowPcb        = Pcb.CreatePcb();

            nowPcb.FrontPcb.allCols = 24;
            nowPcb.FrontPcb.allRows = 10;
            nowPcb.FrontPcb.allNum  = 240;
            nowPcb.FrontPcb.or_hl   = 0.3;
            nowPcb.FrontPcb.or_hu   = 0.4;
            nowPcb.FrontPcb.or_vl   = 0.1;
            nowPcb.FrontPcb.or_vu   = 0.5;
            nowPcb.FrontPcb.dr_hu   = 0.02;
            nowPcb.FrontPcb.dr_vu   = 0.02;
            if (fuckType.SelectedValue.ToString() == "请添加新的拍摄方案")
            {
                MessageBox.Show("请去添加页面添加新的拍摄方案");
                return;
            }
            Settings.Default.num = 0;
            conncamera();
            tbSavePath.Enabled = false;
            button6_Click_1();
            button9.Enabled = false;
            btnFuckDetectThisPcb.Enabled = true;
            ismoveative              = false;
            this.xYrulescs           = fuckType.SelectedValue as XYrulescs;
            Settings.Default.canmove = true;
            if (tbSavePath.Text != "图片保存地址,不填为不保存")
            {
                path = tbSavePath.Text;
                try
                {
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                }
                catch
                {
                    MessageBox.Show("请输入正确路径");
                    return;
                }

                needsave = true;
                if (newbackgroundWorker.IsBusy != true)                    //判断BackgroundWorker 是否正在运行异步操作。
                {
                    newbackgroundWorker.RunWorkerAsync("object argument"); //启动异步操作,有两种重载。将触发BackgroundWorker.DoWork事件
                }
            }
            if (this.testDevice != null && this.testDevice.IsOpen && this.Camera.IsOpen)
            {
                iscangetstatus       = true;
                fuckType.Enabled     = false;
                button4.Enabled      = false;
                btnFuckStart.Enabled = false;
                button5.Enabled      = true;
                button11.Enabled     = true;
                if (backgroundWorker.IsBusy != true)                    //判断BackgroundWorker 是否正在运行异步操作。
                {
                    backgroundWorker.RunWorkerAsync("object argument"); //启动异步操作,有两种重载。将触发BackgroundWorker.DoWork事件
                }
            }
            else
            {
                MessageBox.Show("请连接设备");
            }
        }