Exemple #1
0
        //保存
        private void rb_Save_Click(object sender, EventArgs e)
        {
            this.drawArea.Focus();
            if (this.drawArea.GraphicsList.Count > 0)
            {
                this.drawArea.GraphicsList.UnselectAll();
                this.drawArea.Refresh();
            }
            if (this.drawArea.Image == null || this.lb_ImageName.Text == "")
            {
                return;
            }
            if (!this.IsBack && GetConfig.IsAddLocMap && this.frmSLocMap != null)
            {
                this.frmSLocMap.Save();
            }
            drawArea.Refresh();
            string xml  = SaveImageToXml.SaveImageToXml2(drawArea, this.lb_ImageName.Text);
            string name = this.lb_ImageName.Text;

            if (xml == "" && (this.CurrentObj == null || !this.CurrentObj.ImagePath.Contains("Mark")))
            {
                preferImages.ReflashName(name);//刷新图片名
                return;
            }
            bool   success = false;
            Bitmap b       = ImageOpe.FromGraphics((Control)drawArea, this.drawArea.Width, this.drawArea.Height);
            Bitmap bt      = ImageOpe.KiResizeImage(b, this.sourceImage.Width, this.sourceImage.Height, 0);

            // string name = this.lb_ImageName.Text;
            if (this.IsBack)
            {
                success = this.backImages.SaveMark(bt, ref name);
            }
            else
            {
                if (this.CurrentObj == null)
                {
                    return;
                }
                success = this.preferImages.SaveMark(bt, this.CurrentObj, xml, ref name);
            }
            if (!success)
            {
                MessageBoxEx.Show("保存失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                this.lb_ImageName.Text = name;
            }
            if (b != null)
            {
                b.Dispose();
            }
            if (bt != null)
            {
                bt.Dispose();
            }
        }
Exemple #2
0
        public void Save()
        {
            if (this.mImage == null)
            {
                return;
            }
            Bitmap b = null, bt = null, btp = null;

            try
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                FileOperator ope         = new FileOperator();
                string       newFileName = "Map" + this.CurrentCtl.FileName.Replace("Mark", "");
                string       Newpath     = path + newFileName;
                b   = ImageOpe.FromGraphics((Control)drawArea, drawArea.Width - 2, drawArea.Height - 2);
                bt  = ImageOpe.KiResizeImage(b, 2 * GetConfig.RS_LocMapWidth, 2 * GetConfig.RS_LocMapHeight, 0);
                btp = DrawString(bt, this.cmb_Part.Text.Trim(), this.cmb_Explain.Text.Trim());
                btp.Save(Newpath);
                if (this.mLocMap == null)
                {
                    this.mLocMap               = new MLocationMap();
                    mLocMap.MAP_ID             = this.mImage.IMAGE_ID;
                    mLocMap.EXAM_ACCESSION_NUM = this.mImage.EXAM_ACCESSION_NUM;
                }
                mLocMap.MAP_PART      = this.cmb_Part.Text.Trim();
                mLocMap.MAP_EXPLAIN   = this.cmb_Explain.Text.Trim();
                mLocMap.MAP_TIME      = System.DateTime.Now;
                mLocMap.MARK_INF      = save.SavePoint(this.drawArea);
                mLocMap.MAP_NAME      = LocalMapName;
                mLocMap.MAP_PATH      = this.mImage.IMAGE_PATH.Substring(0, this.mImage.IMAGE_PATH.LastIndexOf("/") + 1) + newFileName;
                CurrentCtl.LocMapPath = Newpath;
                int       i  = 0;
                ImageCopy ic = new ImageCopy();
                i = ic.FileUpLoad(mLocMap, Newpath);
                if (i < 0)
                {
                    MessageBoxEx.Show("±£´æʧ°Ü£¡", "¾¯¸æ");
                }
                else
                {
                    ((ImgObj)CurrentCtl.ImgObj).MLocationMap = mLocMap;
                }
            }
            catch { MessageBoxEx.Show("±£´æʧ°Ü£¡", "¾¯¸æ"); }
            finally
            {
                b.Dispose();
                bt.Dispose();
                btp.Dispose();
            }
        }
Exemple #3
0
 private void tb_Contrast_Leave(object sender, EventArgs e)
 {
     this.filteredImage = ImageOpe.FromGraphics((Control)drawArea, drawArea.Width, drawArea.Height);
 }
Exemple #4
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (this.mImage == null)
            {
                return;
            }
            Bitmap b = null, bt = null, btp = null;

            try
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                FileOperator ope         = new FileOperator();
                string       newFileName = "Map" + this.Lb_ImgName.Text;
                string       Newpath     = path + newFileName;
                b   = ImageOpe.FromGraphics((Control)drawArea, drawArea.Width - 2, drawArea.Height - 2);
                bt  = ImageOpe.KiResizeImage(b, 2 * GetConfig.RS_LocMapWidth, 2 * GetConfig.RS_LocMapHeight, 0);
                btp = DrawString(bt, this.cmb_Part.Text.Trim(), this.cmb_Explain.Text.Trim());
                btp.Save(Newpath);
                if (this.mLocMap == null)
                {
                    this.mLocMap               = new MLocationMap();
                    mLocMap.MAP_ID             = this.mImage.IMAGE_ID;
                    mLocMap.EXAM_ACCESSION_NUM = this.mImage.EXAM_ACCESSION_NUM;
                }
                mLocMap.MAP_PART    = this.cmb_Part.Text.Trim();
                mLocMap.MAP_EXPLAIN = this.cmb_Explain.Text.Trim();
                mLocMap.MAP_TIME    = System.DateTime.Now;
                mLocMap.MARK_INF    = save.SavePoint(this.drawArea);
                mLocMap.MAP_NAME    = LocalMapName;
                mLocMap.MAP_PATH    = this.mImage.IMAGE_PATH.Substring(0, this.mImage.IMAGE_PATH.LastIndexOf("/") + 1) + newFileName;
                ((ImgObj)CurrentCtl.ImgObj).MLocationMap = (object)mLocMap;
                CurrentCtl.LocMapPath = Newpath;
                int       i  = 0;
                ImageCopy ic = new ImageCopy();
                i = ic.FileUpLoad(mLocMap, Newpath);
                if (i < 0)
                {
                    MessageBoxEx.Show("保存失败!", "警告");
                }
                if (this.isRpt)
                {
                    ((ImgObj)CurrentCtl.ImgObj).MLocationMap = mLocMap;
                    if (!this.CurrentCtl.GetCheck())
                    {
                        this.CurrentCtl.SetCheck(true);
                    }
                    else
                    {
                        this.word.PasteImgWithLocMap(this.CurrentCtl.FilePath, this.CurrentCtl.LocMapPath);
                    }
                    this.Close();
                }
            }
            catch { MessageBoxEx.Show("保存失败!", "警告"); }
            finally
            {
                b.Dispose();
                bt.Dispose();
                btp.Dispose();
            }
        }