コード例 #1
0
ファイル: frmSimpleLocMap.cs プロジェクト: xuanximoming/PIC
        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();
            }
        }
コード例 #2
0
ファイル: frmRptImages.cs プロジェクト: xuanximoming/PIC
        private ImgObj AddImgObj(string newFileName, string path)
        {
            SIS_Model.MImage Mimage = new SIS_Model.MImage();
            Mimage.EXAM_ACCESSION_NUM = frmMainForm.examInf.ExamAccessionNum;
            Mimage.IMAGE_PATH         = GetConfig.ServerImgDir + "/" + frmMainForm.examInf.ReqDateTime + "/" + frmMainForm.examInf.ExamAccessionNum + "/" + newFileName;//linux上文件保存路径
            ImageCopy imgCopy = new ImageCopy();

            if (imgCopy.FileUpLoad(Mimage, path, false) != 1)
            {
                return(null);
            }
            ImgObj imgObj = new ImgObj(path, false, Mimage);

            frmMainForm.examInf.ArrayImages.Add(imgObj);
            this.arrayImg.Add(imgObj);
            return(imgObj);
        }
コード例 #3
0
ファイル: SaveReportCls.cs プロジェクト: xuanximoming/PIC
        /// <summary>
        /// 保存图片并记录入图片表(注意是否打勾)
        /// </summary>
        /// <param name="arrayImg"></param>
        public bool SaveImage(List <ImgObj> arrayImg, SIS_Model.MWorkList worklist)
        {
            bool isSuccess = true;
            int  j         = 0;

            for (int i = 0; i < arrayImg.Count; i++)
            {
                ImgObj obj   = (ImgObj)arrayImg[i];
                MImage model = (MImage)obj.MImage;
                if (model == null)
                {
                    model                    = new MImage();
                    model.IMAGE_PATH         = CreateServerPath(obj.ImagePath);
                    model.EXAM_ACCESSION_NUM = worklist.EXAM_ACCESSION_NUM;
                }
                else
                {
                    model.IMAGE_PATH = CreateServerPath(obj.ImagePath);
                }
                model.IS_PRINT   = (obj.IsCheck == true ? 1 : 0);
                model.IMAGE_DATE = System.DateTime.Now;
                if (obj.IsDeleted)
                {
                    imgCopy.DeleteImg(model);
                }
                else
                {
                    if (imgCopy.FileUpLoad(model, obj.ImagePath, false) != 1)
                    {
                        // MessageBox.Show("图片" + obj.ImagePath + "保存失败,请检查网络连接情况", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        isSuccess = false;
                    }
                    else
                    {
                        j++;
                    }
                }
            }
            worklist.IMAGE_COUNTS = j;
            return(isSuccess);
        }
コード例 #4
0
ファイル: frmLocMap.cs プロジェクト: xuanximoming/PIC
        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();
            }
        }
コード例 #5
0
        /// <summary>
        /// 保存图像处理后的效果
        /// </summary>
        /// <param name="image">新图像</param>
        /// <param name="Obj">图像数据库对象</param>
        /// <param name="xml">处理信息</param>
        /// <param name="name">旧图像名</param>
        /// <returns>是否保存成功</returns>
        public bool SaveMark(Image image, ImgObj Obj, string xml, ref string name)
        {
            if (!Directory.Exists(Dir))
            {
                Directory.CreateDirectory(Dir);
            }
            MImage img = (MImage)Obj.MImage;

            if (xml == "" && name.Contains("Mark"))
            {
                img.MARK_IMAGE_PATH = "";
                img.MARK_INF        = "";
                SIS_BLL.BImage bi = new SIS_BLL.BImage();
                if (bi.Update(img, " where IMAGE_ID = " + img.IMAGE_ID) < 0)
                {
                    return(false);
                }
                else
                {
                    Obj.MarkImgPath = "";
                    Obj.MarkInf     = "";
                    name            = name.Replace("Mark", "");
                    string           newpath = Dir + "\\" + name;
                    userCtrPictureEx u       = (userCtrPictureEx)this.p_PreferImages.Controls[name];
                    u.Picture.LoadFile(newpath);
                    u.Picture.IsMark    = false;
                    u.l_Buttom.Text     = name;
                    this.CurrentCtlName = u.Picture.FileName;
                    this.dbClick(u.Picture);
                    return(true);
                }
            }
            else
            {
                string newPath = "";
                string oldName = name;
                if (xml != "" && !name.Contains("Mark"))
                {
                    name                = "Mark" + name;
                    newPath             = Dir + "\\" + name;
                    img.MARK_IMAGE_PATH = GetConfig.ServerImgDir + "/" + frmMainForm.examInf.ReqDateTime + "/" + frmMainForm.examInf.ExamAccessionNum + "/" + name;
                }
                else
                {
                    newPath = Obj.MarkImgPath;
                    oldName = name.Replace("Mark", "");
                }
                image.Save(newPath);
                img.MARK_INF = xml;
                ImageCopy imgCopy = new ImageCopy();
                if (imgCopy.FileUpLoad(img, newPath, true) != 1)
                {
                    return(false);
                }
                else
                {
                    Obj.MarkImgPath = newPath;
                    Obj.MarkInf     = xml;
                    userCtrPictureEx u = (userCtrPictureEx)this.p_PreferImages.Controls[oldName];
                    u.Picture.LoadFile(newPath);
                    u.Picture.IsMark    = true;
                    u.l_Buttom.Text     = name;
                    this.CurrentCtlName = u.Picture.FileName;
                    this.dbClick(u.Picture);
                    return(true);
                }
            }
        }