private void initLogisticCompany()//设置物流公司
        {
            lc.Clear();
            pictureBox2.Controls.Clear();

            LogisticCompanyTemplate modifyTemplate = LogisticCompanyTemplateService.GetLogisticTemplate(templateCode);

            List <LogisticCompany> logCompany = LogisticCompanyService.GetAllLogisticCompany();

            mtCompany.Properties.DataSource    = logCompany;
            mtCompany.Properties.DisplayMember = "name";
            mtCompany.Text = modifyTemplate.LogisticCompanyName;
            mtCompany.Properties.ValueMember = "code";
            mtCompany.EditValue = modifyTemplate.LogisticCompanyCode;

            templateName = modifyTemplate.LogisticCompanyName;
            mtName.Text  = modifyTemplate.LogisticCompanyName.ToString();

            mtCover.SelectedIndexChanged -= new EventHandler(mtCover_SelectedIndexChanged);
            string coverArea = modifyTemplate.CoverAreaList;

            string[] x = coverArea.Split(',');

            foreach (string y in x)
            {
                int count = 0;
                foreach (CheckedListBoxItem c in mtCover.Items)
                {
                    if (count >= 2)
                    {
                        if (y == c.Value.ToString())
                        {
                            c.CheckState = CheckState.Checked;
                            break;
                        }
                    }
                    count++;
                }
            }
            mtCover.SelectedIndexChanged += new EventHandler(mtCover_SelectedIndexChanged);

            MemoryStream ms = new MemoryStream(modifyTemplate.PreviewImage);

            pictureBox2.Image = Image.FromStream(ms);
            lcti = LogisticCompanyTemplateItemService.GetLogisticTemplateItems(modifyTemplate.LogisticCompanyCode);  //模版标签
            foreach (LogisticCompanyTemplateItem l in lcti)
            {
                LabelControl lctemp = new LabelControl();
                lctemp.Text       = l.ItemName;
                lctemp.Location   = new Point(l.ItemX, l.ItemY);
                lctemp.MouseDown += new MouseEventHandler(control_MouseDown);
                lctemp.MouseMove += new MouseEventHandler(control_MouseMove);
                pictureBox2.Controls.Add(lctemp);
                lc.Add(lctemp);
            }
        }
Beispiel #2
0
        private void PreviewTemplate()
        {
            if (gridView1.FocusedRowHandle >= 0)
            {
                string logisticCode = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "LogisticCompanyTemplateCode").ToString();
                LogisticCompanyTemplate            lct         = LogisticCompanyTemplateService.GetLogisticTemplate(logisticCode);
                List <LogisticCompanyTemplateItem> logTempItem = LogisticCompanyTemplateItemService.GetLogisticTemplateItems(lct.LogisticCompanyCode);

                MemoryStream ms = new MemoryStream(lct.PreviewImage);
                pictureBox1.Image = Image.FromStream(ms);
                pictureBox1.Controls.Clear();
                foreach (LogisticCompanyTemplateItem l in logTempItem)
                {
                    LabelControl lctemp = new LabelControl();
                    lctemp.Text     = l.ItemName;
                    lctemp.Location = new Point(l.ItemX, l.ItemY);
                    pictureBox1.Controls.Add(lctemp);
                }
            }
        }