void ReleaseDesignerOutlets()
        {
            if (Img1 != null)
            {
                Img1.Dispose();
                Img1 = null;
            }

            if (Btn1 != null)
            {
                Btn1.Dispose();
                Btn1 = null;
            }

            if (Img3 != null)
            {
                Img3.Dispose();
                Img3 = null;
            }

            if (Btn3 != null)
            {
                Btn3.Dispose();
                Btn3 = null;
            }

            if (Img2 != null)
            {
                Img2.Dispose();
                Img2 = null;
            }

            if (Btn2 != null)
            {
                Btn2.Dispose();
                Btn2 = null;
            }

            if (Img4 != null)
            {
                Img4.Dispose();
                Img4 = null;
            }

            if (Btn4 != null)
            {
                Btn4.Dispose();
                Btn4 = null;
            }
        }
Beispiel #2
0
        //--------------------------------------------------------------------------------
        /// <summary>
        /// Triggered when the call to automatically resize all pictures is made.
        /// </summary>
        private void AutoResize()
        {
            String NewFilePath = @"C:\iPrint\iPrintEditor\"; //to be changed

            //Get the selected pictures form the global Variable keeping track of selections
            foreach (string filename in clsGlobalVariables.SelectedPics)
            {
                FileInfo file_info = new FileInfo(filename);
                String   FileName  = file_info.Name;         // Get the full path of the selected files

                using (Image Img = Image.FromFile(filename)) //load the image
                {
                    Image Img2;
                    Img2 = ImageResize.ResizeImage(Img);                                        // Call the resizing function
                    Img2.Save(NewFilePath + FileName, System.Drawing.Imaging.ImageFormat.Jpeg); //Save the resized image in the Editor folder
                    //pic.Image = new Bitmap(Img);
                }
            }
        }
Beispiel #3
0
        private void Set_dTimer()
        {
            DoubleAnimation img2AnimateHeight = new DoubleAnimation
            {
                From           = h,
                To             = h - 20,
                Duration       = TimeSpan.FromSeconds(1),
                AutoReverse    = true,
                RepeatBehavior = new RepeatBehavior(20)
            };
            DoubleAnimation img2AnimateWidth = new DoubleAnimation
            {
                From           = w,
                To             = w - 20,
                Duration       = TimeSpan.FromSeconds(1),
                AutoReverse    = true,
                RepeatBehavior = new RepeatBehavior(20)
            };

            Img2.BeginAnimation(Image.HeightProperty, img2AnimateHeight);
            Img2.BeginAnimation(Image.WidthProperty, img2AnimateWidth);
        }
Beispiel #4
0
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        Random rnd  = new Random();
        string tiem = DateTime.Now.ToString("yyyyMMdd");

        if (Img2.HasFile)
        {
            string imageName       = Img2.FileName;
            string extension_image = Path.GetExtension(imageName);
            bool   extension_type  = extension_image.Equals(".jpeg") || extension_image.Equals(".png") || extension_image.Equals(".jpg") || extension_image.Equals(".gif") || extension_image.Equals(".bmt");
            if (extension_type)
            {
                int    num        = rnd.Next(5000, 10000);
                string path_image = "file/image/" + tiem;
                DmFramework.IO.FileHelper.EnsureDirectory(System.Web.HttpContext.Current.Server.MapPath("../../" + path_image));
                try
                {
                    Img2.SaveAs(System.Web.HttpContext.Current.Server.MapPath("../../" + path_image + "/" + num.ToString() + extension_image));
                    Label2.Text = "上传成功";
                }
                catch (Exception ex)
                {
                    Label2.Text = ex.Message;
                }
                frmProductImage2.Text = path_image + "/" + num.ToString() + extension_image;
            }
            else
            {
                Label2.Text = "图片格式为jpeg,png,jpg,gif,bmt";
            }
        }
        else
        {
            Label2.Text = "文件为空,请浏览要上传文件!";
        }
    }
        public void Compare()
        {
            _exceptedPoints = new List <Point>();
            double acceptableDelta = 255 * 3 * 0.1;

            int width  = Math.Min(Img1.Width, Img2.Width);
            int height = Math.Min(Img1.Height, Img2.Height);

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    var color1 = Img1.GetPixel(i, j);
                    var color2 = Img2.GetPixel(i, j);

                    if (Math.Abs(GetSum(color1) - GetSum(color2)) > acceptableDelta)
                    {
                        _exceptedPoints.Add(new Point(i, j));
                    }
                }
            }

            FindAreas();
        }