Пример #1
0
        /// <summary>This form will get the necessary images off disk so that it can control layout.</summary>
        public void SetImage(Document thisDocument, string displayTitle)
        {
            //for now, the document is single. Later, it will get groups for composite images/mounts.
            Text         = displayTitle;
            displayedDoc = thisDocument;
            ArrayList docNums = new ArrayList();

            docNums.Add(thisDocument.DocNum);
            string fileName = (string)Documents.GetPaths(docNums)[0];

            if (!File.Exists(fileName))
            {
                MessageBox.Show(fileName + " could not be found.");
                return;
            }
            try{
                ImageCurrent = (Bitmap)Bitmap.FromFile(fileName);              //only jpg and gif allowed to run this method anyway.
            }
            catch (System.Exception exception) {
                MessageBox.Show(Lan.g(this, exception.Message));
                ImageCurrent = null;
            }
            RecZoom.Width = 0;
            DisplayImage(true);
        }
Пример #2
0
        ///<summary>This form will get the necessary images off disk or from the cloud so that it can control layout.</summary>
        public void SetImage(Document thisDocument, string displayTitle)
        {
            //for now, the document is single. Later, it will get groups for composite images/mounts.
            Text         = displayTitle;
            displayedDoc = thisDocument;
            List <long> docNums = new List <long>();

            docNums.Add(thisDocument.DocNum);
            string fileName = CloudStorage.PathTidy(Documents.GetPaths(docNums, ImageStore.GetPreferredAtoZpath())[0]);

            if (!FileAtoZ.Exists(fileName))
            {
                MessageBox.Show(fileName + " +" + Lan.g(this, "could not be found."));
                return;
            }
            ImageCurrent = (Bitmap)FileAtoZ.GetImage(fileName);
            DisplayImage();
        }
Пример #3
0
        /// <summary>This form will get the necessary images off disk so that it can control layout.</summary>
        public void SetImage(Document thisDocument, string displayTitle)
        {
            //for now, the document is single. Later, it will get groups for composite images/mounts.
            Text         = displayTitle;
            displayedDoc = thisDocument;
            List <long> docNums = new List <long>();

            docNums.Add(thisDocument.DocNum);
            string fileName = (string)Documents.GetPaths(docNums, ImageStore.GetPreferredAtoZpath())[0];

            if (!File.Exists(fileName))
            {
                MessageBox.Show(fileName + " could not be found.");
                return;
            }
            try {
                ImageCurrent = new Bitmap(fileName);
                renderImage  = ImageHelper.ApplyDocumentSettingsToImage(thisDocument, ImageCurrent,
                                                                        //ContrDocs.ApplyDocumentSettingsToImage(thisDocument,ImageCurrent,
                                                                        ImageSettingFlags.CROP | ImageSettingFlags.COLORFUNCTION);
                if (renderImage == null)
                {
                    imageZoom        = 1;
                    imageTranslation = new PointF(0, 0);
                }
                else
                {
                    float matchWidth = PictureBox1.Width - 16;
                    matchWidth = (matchWidth <= 0?1:matchWidth);
                    float matchHeight = PictureBox1.Height - 16;
                    matchHeight      = (matchHeight <= 0?1:matchHeight);
                    imageZoom        = (float)Math.Min(matchWidth / renderImage.Width, matchHeight / renderImage.Height);
                    imageTranslation = new PointF(PictureBox1.Width / 2.0f, PictureBox1.Height / 2.0f);
                }
                zoomLevel  = 0;
                zoomFactor = 1;
            }
            catch (System.Exception exception) {
                MessageBox.Show(Lan.g(this, exception.Message));
                ImageCurrent = null;
                renderImage  = null;
            }
            UpdatePictureBox();
        }