Пример #1
0
        private bool ReadConfig()
        {
            object obj = SerializeHelper.DeSerialize(typeof(PrintConfig));

            if (obj == null)
            {
                MessageBox.Show("读取模板配置文件失败!");
                return(false);
            }
            m_printConfig = (PrintConfig)obj;
            m_printImg    = PrintConfigDraw.Draw(m_printConfig);
            return(true);
        }
Пример #2
0
        /// <summary>
        /// 读取模板配置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbTemplate_SelectedIndexChanged(object sender, EventArgs e)
        {
            Global.cbTemplate_SelectedIndex = cbTemplate.SelectedItem.ToString();

            string cbTemplateSelectedValue = cbTemplate.SelectedItem.ToString();
            string Message = "模板中有变量,请先设置数据源后,再选择对应模板!";

            if (cbTemplateSelectedValue == "默认模板")
            {
                //m_printImg = null;
                ReadConfig();
                PrintConfigDraw.ReturnContrl(m_printConfig, panel1);
                return;
            }

            if (dataGridView1.CurrentCell == null)
            {
                if (cbTemplateSelectedValue == "30#20mm")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "30#25mm")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "30#40mm")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "35#20mm")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "40#30mm")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "40#60mm_Var09")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "40#60mm_Var10")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "40#60mm_Var11")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "40#60mm_Var13")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "40#60mm_Var15")
                {
                    MessageBox.Show(Message);
                    return;
                }
                if (cbTemplateSelectedValue == "105#50mm")
                {
                    MessageBox.Show(Message);
                    return;
                }
            }
            else
            {
                m_printImg = null;
                ReadConfig();
                PrintConfigDraw.ReturnContrl(m_printConfig, panel1);
            }
        }