Exemple #1
0
        private void ReFixNgCode2()
        {
            //NgType ngType = Ngcodes.GetNgCodes(process);
            NgType ngType = Ngcodes.GetNgCodes(process_cbx.SelectedItem.ToString());

            if (ngType == null)
            {
                return;
            }
            int i   = 0;
            int n   = 0;
            int top = 6;
            int var = (int)panel1.Width / 450;

            foreach (RadioButton rad in panel1.Controls)
            {
                //分4行显示
                if (i % var == 0 && i != 0)
                {
                    top += 40;
                    n    = 0;
                }
                rad.Top = top - 10;
                //控件左上角相对于容器的左上角坐标
                rad.Location = new Point(n * 440, top);
                rad.Click   += new EventHandler(panel1_Click);
                n++;
                i++;
                //n=0;
            }
        }
Exemple #2
0
        /// <summary>
        /// 加载NG Code RadioButton的列表
        /// </summary>
        /// <param name="line"></param>
        /// <param name="process"></param>
        private void GetNgCode(string line, string process)
        {
            //NgType ngType = Ngcodes.GetNgCodes(process);
            panel1.Controls.Clear();
            NgType ngType = Ngcodes.GetNgCodes(process_cbx.SelectedItem.ToString());

            if (ngType == null)
            {
                return;
            }
            RadioButton[] rads = new RadioButton[ngType.m_Item.Count];
            int           i    = 0;
            int           n    = 0;
            int           top  = 6;
            int           var  = (int)panel1.Height / 40;

            foreach (NgCode cod in ngType.m_Item)
            {
                //分4行显示
                if (i % var == 0 && i != 0)
                {
                    top = 6;
                    n++;
                }
                rads[i]        = new RadioButton();
                rads[i].Width  = 270;
                rads[i].Height = 30;
                Font f = new Font("宋体", 16, FontStyle.Bold);
                rads[i].Font      = f;
                rads[i].ForeColor = Color.Blue;
                rads[i].Name      = cod.code;
                rads[i].Text      = "(" + cod.num + ")" + cod.name;
                rads[i].Visible   = true;
                rads[i].Top       = top - 10;
                //控件左上角相对于容器的左上角坐标
                rads[i].Location = new Point(n * 270, top);
                rads[i].Click   += new EventHandler(panel1_Click);
                panel1.Controls.Add(rads[i]);
                top += 40;
                i++;
                //n=0;
            }
        }
Exemple #3
0
        public bool LoadConfig(string config)
        {
            if (!File.Exists(config))
            {
                return(false);
            }

            try
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.Load(config);
                XmlNodeList nodList = xDoc.SelectSingleNode("NGCODE").ChildNodes;
                int         n       = 0;
                m_AssyList = new string[nodList.Count];
                foreach (XmlNode nod in nodList)
                {
                    NgType ngType = new NgType();
                    ngType.NgTypeName = nod.Name;
                    m_AssyList[n]     = nod.Name;
                    XmlNodeList nodItems = nod.ChildNodes;
                    int         i        = 1;
                    foreach (XmlNode nodItem in nodItems)
                    {
                        NgCode ngCode = new NgCode();
                        ngCode.num  = i;
                        ngCode.code = nodItem.Attributes["code"].Value;
                        ngCode.name = nodItem.Attributes["name"].Value;
                        ngType.m_Item.Add(ngCode);
                        i++;
                    }
                    n++;
                    m_NgList.Add(ngType.NgTypeName, ngType);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }