コード例 #1
0
        private void tsm_add_Click(object sender, EventArgs e)
        {
            int labcount = 0, intlab = 0;

            while (intlab == 0)
            {
                labcount++;
                if (Sl_Label["par_" + labcount.ToString()] == null)
                {
                    intlab = 1;
                }
            }
            string strname = "par_" + labcount.ToString();
            Label  lab_tmp = new Label();

            lab_tmp.Name       = strname;
            lab_tmp.Text       = strname;
            lab_tmp.AutoSize   = true;
            lab_tmp.ForeColor  = Color.Red;
            lab_tmp.BackColor  = Color.Transparent;
            lab_tmp.Location   = new Point(20, 20);
            lab_tmp.Font       = new Font("宋体", 15, FontStyle.Bold);
            lab_tmp.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label_all_MouseDown);
            lab_tmp.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label_all_MouseMove);
            lab_tmp.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.label_all_MouseUp);
            Sl_Label.Add(strname, lab_tmp);
            ImageAddData BarcodeAddData_tmp = new ImageAddData();

            BarcodeAddData_tmp.Name = strname;
            this.Sl_par.Add(strname, BarcodeAddData_tmp);
            this.pic_design.Controls.Add(lab_tmp);
            lab_tmp.BringToFront();
        }
コード例 #2
0
        private void pg_design_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            string strtag = this.pg_design.Tag.ToString();

            if (strtag == "ImageAddData")
            {
                ImageAddData ImageAddDatatmp = (ImageAddData)pg_design.SelectedObject;
                string       new_key         = ImageAddDatatmp.Name;
                Label        lab_tmp         = (Label)this.Sl_Label[new_key];
                if (ImageAddDatatmp.Value == "")
                {
                    lab_tmp.Text = lab_tmp.Name;
                }
                else
                {
                    lab_tmp.Text = ImageAddDatatmp.Value;
                }
                lab_tmp.ForeColor = ImageAddDatatmp.FontColor;
                lab_tmp.Location  = new Point(ImageAddDatatmp.X, ImageAddDatatmp.Y);
                if (ImageAddDatatmp.Bold == true)
                {
                    lab_tmp.Font = new Font("宋体", ImageAddDatatmp.ForeSize, FontStyle.Bold);
                }
                else
                {
                    lab_tmp.Font = new Font("宋体", ImageAddDatatmp.ForeSize, FontStyle.Regular);
                }
            }
            else if (strtag == "ImageData")
            {
                this.pic_design.Height = this.ImageData01.Height;
                this.pic_design.Width  = this.ImageData01.Width;
            }
        }
コード例 #3
0
        /// <summary>
        /// 图片保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsm_save_Click(object sender, EventArgs e)
        {
            string str_ImageData    = this.ImageData01.GetXML();
            string str_ImageAddData = "";

            if (this.Sl_par.Count > 0)
            {
                str_ImageAddData = "<ImageAddData>";
                for (int i = 0; i < Sl_par.Count; i++)
                {
                    ImageAddData ImageAddDatatmp = (ImageAddData)Sl_par.GetByIndex(i);
                    str_ImageAddData = str_ImageAddData + ImageAddDatatmp.GetXML();
                }
                str_ImageAddData = str_ImageAddData + "</ImageAddData>";
            }
            string strxmltmp = "<Data>" + str_ImageData + str_ImageAddData + "</Data>";

            //UserXmlUpdate(sender, e, strxmltmp);


            #region 保存对应条码包的照片
            //ftp: test.cnasis.cn:cnasftp:ftp123
            tsm_view_Click(null, null);
            Bitmap _NewBitmap = new Bitmap(this.pic_view.Width, pic_view.Height);
            //_NewBitmap.SetResolution(203, 203);
            pic_design.DrawToBitmap(_NewBitmap, new Rectangle(0, 0, _NewBitmap.Width, _NewBitmap.Height));
            MemoryStream memStream = new MemoryStream();
            _NewBitmap.Save(memStream, ImageFormat.Jpeg);

            string folderName = CnasUtilityTools.GetFolderName(EUploadType.Set);

            ImageCache imageCache = new ImageCache();
            //保存图片
            bool result = imageCache.SaveImageCache(folderName, ImageData01.Name + ".jpg", memStream);

            #endregion

            if (!result)
            {
                MessageBox.Show("对不起!上传图片失败,请检查文件服务器和网络.");
                return;
            }
            else
            {
                this.pic_view.Image = imageCache.GetImageByFolderNameFileName(folderName, ImageData01.Name + ".jpg");
            }

            MessageBox.Show("恭喜你!图片生成成功。");
        }
コード例 #4
0
 private void label_all_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         Label lab_tmp = (Label)sender;
         mouseDownPoint.X = Cursor.Position.X;
         mouseDownPoint.Y = Cursor.Position.Y;
         isMove           = true;
         lab_tmp.Focus();
         //显示属性
         ImageAddData ImageAddDatatmp = (ImageAddData)this.Sl_par[lab_tmp.Name];
         this.pg_design.Tag       = "ImageAddData";
         pg_design.SelectedObject = ImageAddDatatmp;
         pg_design.Refresh();
     }
 }
コード例 #5
0
 private void tsm_del_Click(object sender, EventArgs e)
 {
     if (pg_design.Tag != null && this.pg_design.Tag.ToString() == "ImageAddData")
     {
         ImageAddData ImageAddDatatmp = (ImageAddData)this.pg_design.SelectedObject;
         string       str_info_name   = ImageAddDatatmp.Name;
         Label        lab_tmp         = (Label)this.Sl_Label[str_info_name];
         this.pic_design.Controls.Remove(lab_tmp);
         Sl_Label.Remove(str_info_name);
         Sl_par.Remove(str_info_name);
     }
     else
     {
         MessageBox.Show("对不起!请先选定要删除的参数。");
     }
 }
コード例 #6
0
 /// <summary>
 /// 删除参数
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsm_del_Click(object sender, EventArgs e)
 {
     if (pg_design.Tag != null && this.pg_design.Tag.ToString() == "ImageAddData")
     {
         ImageAddData ImageAddDatatmp = (ImageAddData)this.pg_design.SelectedObject;
         string       str_info_name   = ImageAddDatatmp.Name;
         Label        lab_tmp         = (Label)this.Sl_Label[str_info_name];
         this.prictureDesign.Controls.Remove(lab_tmp);
         Sl_Label.Remove(str_info_name);
         Sl_par.Remove(str_info_name);
     }
     else
     {
         MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("choicechange", EnumPromptMessage.warning, new string[] { "删除", "参数" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #7
0
        private void label_all_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Label lab_tmp = (Label)sender;
                isMove = false;
                //显示属性
                ImageAddData ImageAddDatatmp = (ImageAddData)this.Sl_par[lab_tmp.Name];
                if (lab_tmp.Location.X < 0 || lab_tmp.Location.X > this.pic_design.Width || lab_tmp.Location.Y < 0 || lab_tmp.Location.Y > pic_design.Height)
                {
                    lab_tmp.Location = new Point(ImageAddDatatmp.X, ImageAddDatatmp.Y);
                }
                else
                {
                    ImageAddDatatmp.X = lab_tmp.Location.X;
                    ImageAddDatatmp.Y = lab_tmp.Location.Y;
                }

                this.pg_design.Refresh();
            }
        }
コード例 #8
0
        /// <summary>
        /// 图片保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsm_save_Click(object sender, EventArgs e)
        {
            string str_ImageData    = this.ImageData01.GetXML();
            string str_ImageAddData = "";

            if (this.Sl_par.Count > 0)
            {
                str_ImageAddData = "<ImageAddData>";
                for (int i = 0; i < Sl_par.Count; i++)
                {
                    ImageAddData ImageAddDatatmp = (ImageAddData)Sl_par.GetByIndex(i);
                    str_ImageAddData = str_ImageAddData + ImageAddDatatmp.GetXML();
                }
                str_ImageAddData = str_ImageAddData + "</ImageAddData>";
            }
            string strxmltmp = "<Data>" + str_ImageData + str_ImageAddData + "</Data>";
            //UserXmlUpdate(sender, e, strxmltmp);


            //上传到FTP文件夹的名称
            string folderName = "";

            int upType = Convert.ToInt32(Sl_Parameter["type"]);
            //包图片名称
            string dataUrl = ImageData01.Name + ".jpg";

            // 确定上传图片的类型
            // 1-包  2-器械
            EUploadType eUpType = (EUploadType)upType;

            folderName = CnasUtilityTools.GetFolderName(eUpType);


            #region 保存对应条码包的照片
            //ftp: test.cnasis.cn:cnasftp:ftp123
            tsm_view_Click(null, null);
            Bitmap _NewBitmap = new Bitmap(this.PrictureView.Width, PrictureView.Height);
            //_NewBitmap.SetResolution(203, 203);
            prictureDesign.DrawToBitmap(_NewBitmap, new Rectangle(0, 0, _NewBitmap.Width, _NewBitmap.Height));
            MemoryStream memStream = new MemoryStream();
            _NewBitmap.Save(memStream, ImageFormat.Jpeg);


            ImageCache imageCache = new ImageCache();

            //保存图片
            bool result = imageCache.SaveImageCache(folderName, ImageData01.Name + ".jpg", memStream);
            if (!result)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("errorimage", EnumPromptMessage.error, new string[] { "系统错误" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            #endregion

            //获取图片
            Image picViewImage = imageCache.GetImageByFolderNameFileName(folderName, ImageData01.Name + ".jpg");
            //返回不等于""说明有错误信息返回,弹出提示
            if (picViewImage == null)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("errorseeim", EnumPromptMessage.error, new string[] { "" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                this.PrictureView.Image = picViewImage;
            }

            //rexxie通过条形码更新数据库:关联文件名
            CnasRemotCall reCnasRemotCall = new CnasRemotCall();
            SortedList    sltmp           = new SortedList();
            SortedList    sltmp01         = new SortedList();

            //图片存储类型
            sltmp.Add(1, upType);
            //包ID
            sltmp.Add(2, Sl_Parameter["pack_id"]);
            //包条码
            sltmp.Add(3, Sl_Parameter["pack_barcode"]);
            //图片名称
            sltmp.Add(4, dataUrl);
            //状态默认可用
            sltmp.Add(5, 1);
            sltmp01.Add(1, sltmp);
            //string gg = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS_image-data-add001", sltmp01, null);
            int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS_image-data-add001", sltmp01, null);

            if (recint > -1)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "照片" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }