Exemplo n.º 1
0
 private void simpleButton2_Click(object sender, EventArgs e)   //新建标签
 {
     if (mtItem.Text != string.Empty)
     {
         LabelControl lctemp = new LabelControl();
         lc.Add(lctemp);
         int index = lc.Count - 1;
         lc[index].Text = mtItem.Text;
         lc[index].BringToFront();
         lc[index].Visible = true;
         this.pictureBox2.Controls.Add(lctemp);
         lc[index].MouseDown += new MouseEventHandler(control_MouseDown);
         lc[index].MouseMove += new MouseEventHandler(control_MouseMove);
         lc[index].Location   = new Point(this.pictureBox2.Width / 2, this.pictureBox2.Height / 2);
         LogisticCompanyTemplateItem temp = new LogisticCompanyTemplateItem();
         temp.LogisticCompanyItemCode     = System.Guid.NewGuid().ToString();
         temp.LogisticCompanyTemplateCode = templateCode;
         temp.ItemName  = mtItem.Text;
         temp.ItemValue = mtItem.Text;
         temp.ItemX     = pictureBox2.Width / 2;
         temp.ItemY     = pictureBox2.Height / 2;
         LogisticCompanyTemplateItemService.AddLogisticCompanyTemplateItem(temp);
         lcti.Clear();
         lcti        = LogisticCompanyTemplateItemService.GetLogisticTemplateItems(templateCode);
         mtItem.Text = string.Empty;
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
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);
                }
            }
        }