/// <summary>
        /// 双击出错列表,高亮显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void wrongList_LineDoubleClick(object sender, EventArgs e)
        {
            for (int k = 0; k < this.tabControlView.TabCount; k++)
            {
                if (this.errorForm.HighLightLine != -1 && this.tabControlView.TabPages[k].Text == CodePageName)
                {//找到指令页面
                    this.tabControlView.SelectedIndex = k;
                    System.Windows.Forms.TabPage tempPage = this.tabControlView.TabPages[k];
                    ConfigCodeEdit codeEditor = (ConfigCodeEdit)(tempPage.Controls[0]);
                    codeEditor.CodeEditor.ShowHighLightRow(this.errorForm.HighLightLine);
                    return;
                }
                else if (this.errorForm.SelectCtrlinfo != null
                    && this.tabControlView.TabPages[k].Text == this.errorForm.SelectCtrlinfo[0])
                {
                    this.tabControlView.SelectedIndex = k;
                    if (this.errorForm.SelectCtrlinfo[1] != null)
                    {
                        CassView cassView = (CassView)(this.tabControlView.TabPages[k].Controls[0].GetNextControl(this.tabControlView.TabPages[k].Controls[0], false));

                        //把当前的属性保存 再赋值 设置属性结束后再还原
                        //连线模式控件VISIBLE属性为false
                        bool curValue = cassView.LinesEditable;
                        cassView.LinesEditable = false;

                        for (int x = 0; x < cassView.Controls.Count; x++)
                        {
                            PropertyDescriptor serialNumber = TypeDescriptor.GetProperties(cassView.Controls[x])["SerialNumber"];
                            PropertyDescriptor IsError = TypeDescriptor.GetProperties(cassView.Controls[x])["IsError"];
                            if (serialNumber.GetValue(cassView.Controls[x]).ToString() == this.errorForm.SelectCtrlinfo[1])
                            {//如果是当前选择的控件 则保存原有颜色
                                ((HostControl)this.tabControlView.TabPages[k].Controls[0]).ScrollControlIntoView(cassView);
                                //选中查找到的控件
                                List<Component> select = new List<Component>();
                                select.Add(cassView.Controls[x]);
                                ISelectionService selectionService = (ISelectionService)(CurrentDocumentsHostControl.HostDesign.GetService(typeof(ISelectionService)));
                                if (selectionService != null)
                                { selectionService.SetSelectedComponents(select, SelectionTypes.Replace); }

                                ShowControls(0);

                                this.controlfilteredPropertyGrid.SelectedObjects = new object[] { cassView.Controls[x] };
                                IsError.SetValue(cassView.Controls[x], true);
                            }
                            else
                            { IsError.SetValue(cassView.Controls[x], false); }
                        }
                        cassView.LinesEditable = curValue;
                    }
                    return;
                }
            }
            if (this.errorForm.HighLightLine != -1)
            {//未找到指令页面,则重新打开
                ConfigCodeEdit codeEditor = new ConfigCodeEdit();
                System.Windows.Forms.TabPage tempPage = new System.Windows.Forms.TabPage(CodePageName);
                codeEditor.Parent = tempPage;
                codeEditor.Dock = DockStyle.Fill;
                this.tabControlView.TabPages.Add(tempPage);
                this.tabControlView.SelectedIndex = this.tabControlView.TabPages.Count - 1;
                codeEditor.CodeEditor.Text = CodeText;
                codeEditor.CodeEditor.ShowHighLightRow(this.errorForm.HighLightLine);
                return;
            }
        }
        /// <summary>
        /// 根据指令列表添加指令表页面
        /// 并切换到指令页面
        /// </summary>
        /// <param name="CodeValue"></param>
        /// <returns></returns>
        private void AddCodeListPage(List<string[]> CodeValue)
        {
            ConfigCodeEdit codeEditor = new ConfigCodeEdit();

            System.Windows.Forms.TabPage tempPage;
            int pageIndex = findCodePage();
            if (pageIndex != -1)
            {
                tempPage = this.tabControlView.TabPages[pageIndex];
                codeEditor = (ConfigCodeEdit)(tempPage.Controls[0]);
                codeEditor.CodeEditor.Text = null;
                this.tabControlView.SelectedIndex = pageIndex;
            }
            else
            {
                tempPage = new System.Windows.Forms.TabPage(CodePageName);
                codeEditor.Parent = tempPage;
                codeEditor.Dock = DockStyle.Fill;
                this.tabControlView.TabPages.Add(tempPage);
                this.tabControlView.SelectedIndex = this.tabControlView.TabPages.Count - 1;
            }
            saveForm.Enabled = true;
            saveForm.Text = "保存 " + tabControlView.SelectedTab.Text;

            for (int i = 0, row = 0; i < CodeValue.Count; i++)
            {
                if (CodeValue[i] != null)
                {
                    if (i != 0 && CodeValue[i][0].EndsWith(":"))
                    {//遇到新控件串空行
                        codeEditor.CodeEditor.InsertLine(row, "");
                        row++;
                    }
                    codeEditor.CodeEditor.FormatInsert(CodeValue[i][0], CodeValue[i][1], ref row);
                    row++;
                }
            }
            //将生成的指令信息存放至待保存指令信息中
            CodeText = codeEditor.CodeEditor.Text;
        }
        /// <summary>
        /// 打开工程目录中的Code.IL
        /// 不存在则新建
        /// </summary>
        private void OpenCodetext()
        {
            ConfigCodeEdit codeEditor = new ConfigCodeEdit();
            System.Windows.Forms.TabPage tempPage;
            //指令页面存在则翻到该页
            int pageIndex = findCodePage();
            if (pageIndex != -1)
            {
                tempPage = this.tabControlView.TabPages[pageIndex];
                codeEditor = (ConfigCodeEdit)(tempPage.Controls[0]);
                this.tabControlView.SelectedIndex = pageIndex;
                return;
            }

            tempPage = new System.Windows.Forms.TabPage(CodePageName);
            codeEditor.Parent = tempPage;
            codeEditor.Dock = DockStyle.Fill;
            this.tabControlView.TabPages.Add(tempPage);
            this.tabControlView.SelectedIndex = this.tabControlView.TabPages.Count - 1;
            if (CodeText != null)
            {//有保存值则直接赋值后返回 否则从工程文件夹中读取
                codeEditor.CodeEditor.Text = CodeText;
                return;
            }
            string codepath = Path.Combine(programPath + "//" + ProjectName, CodePageName);
            if (!File.Exists(codepath))
            {//工程目录下不存在Code.il
                return;
            }
            //存在则读取
            FileStream fStream = new FileStream(codepath, FileMode.Open);  //读指令文件内容
            StreamReader sReader = new StreamReader(fStream);              //读取字符
            string eachRow = null;//每行指令
            string Codetext = null;//整体文本信息

            while ((eachRow = sReader.ReadLine()) != null)
            {
                if (eachRow.Trim() != "")
                {
                    if (Codetext != null)//除第一行和最后行外 每行添加个回车
                        Codetext = Codetext + "\n";
                    Codetext += eachRow;
                }
            }
            //格式化完成 更新
            codeEditor.CodeEditor.Text = Codetext;
            CodeText = Codetext;//更新当前工程的指令表信息
            sReader.Close();
            fStream.Close();
        }