Example #1
0
 public void waterPic_Click(object sender, EventArgs e)
 {
     TimeCounter.Start();
     PictureBox1.Image = ImageManager.MakeWaterMark(ImageManager.oldBitmap);
     TimeCounter.Stop();
     TimeElapsed = TimeCounter.Seconds.ToString();
 }
Example #2
0
        public void saveImage_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            if (saveFileDialog == null)
            {
                return;
            }
            saveFileDialog.Filter      = "Jepg文件(*.jpg)|*.jpg|Png文件(*.png)|*.png";
            saveFileDialog.FilterIndex = 1;

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                TimeCounter.Start();
                if (saveFileDialog.FilterIndex == 1)
                {
                    PictureBox1.Image.Save(saveFileDialog.FileName, ImageFormat.Jpeg);
                }
                else
                {
                    PictureBox1.Image.Save(saveFileDialog.FileName, ImageFormat.Png);
                }
                TimeCounter.Stop();
                TimeElapsed = TimeCounter.Seconds.ToString();

                /*Bitmap bit = new Bitmap(pic.width,pic.height);//有时候可能显示的和保存的不一样,可以直接用类似截图的copy保存
                 * Graphics g = Graphics.FromImage(bit);
                 * g.CompositingQuality = CompositingQuality.HighQuality;
                 * g.CopyFromSreen(this.Left,this.top,0, 0, new Size(panel2.Width, panel2.Height));//保存整个窗体为图片
                 * g.CopyFromScreen(picturePhoto.PointToScreen(Point.Empty), Point.Empty, picturePhoto.Size);//只保存某个控件(这里是panel游戏区)
                 * bit.Save(sa.FileName);//默认保存格式为PNG,保存成jpg格式质量不是很好
                 */
            }
        }
Example #3
0
 public void pictureBox1_DragEnterLoad(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         e.Effect = DragDropEffects.Link;
     }
     else
     {
         e.Effect = DragDropEffects.None;
     }
     TimeCounter.Start();
 }
Example #4
0
        public void cropPic_Click(object sender, EventArgs e)
        {
            TimeCounter.Start();
            int width, height;

            width                  = MouseUpedPoint.X - MouseDownedPoint.X;
            height                 = MouseUpedPoint.Y - MouseDownedPoint.Y;
            PictureBox1.Image      = ImageManager.Crop(MouseDownedPoint.X, MouseDownedPoint.Y, width, height);
            ImageManager.oldBitmap = PictureBox1.Image.Clone() as Bitmap;
            TimeCounter.Stop();
            TimeElapsed = TimeCounter.Seconds.ToString();
        }
Example #5
0
        public void loadImage_Click(object sender, EventArgs e)
        {
            Bitmap         bitmap;
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                TimeCounter.Start();
                Image image = (Bitmap)Image.FromFile(openFileDialog.FileName);
                //bitmap = new Bitmap(image, pictureBox1.Width, pictureBox1.Height);
                bitmap = new Bitmap(image);
                ImageManager.oldBitmap = bitmap.Clone() as Bitmap;
                PictureBox1.Image      = bitmap;
                TimeCounter.Stop();
                TimeElapsed = TimeCounter.Seconds.ToString();
                Console.WriteLine(TimeElapsed);
            }
        }
Example #6
0
        public void insertPic_Click(object sender, EventArgs e)
        {
            int            width, height;
            Bitmap         bitmap;
            OpenFileDialog insertDialog = new OpenFileDialog();

            if (insertDialog.ShowDialog() == DialogResult.OK)
            {
                TimeCounter.Start();
                width  = MouseUpedPoint.X - MouseDownedPoint.X;
                height = MouseUpedPoint.Y - MouseDownedPoint.Y;
                Image image = (Bitmap)Image.FromFile(insertDialog.FileName);
                bitmap            = new Bitmap(image, width, height);//这里调整好大小,insert函数插入的rect就是多大
                PictureBox1.Image = ImageManager.InsertImage(bitmap, MouseDownedPoint.X, MouseDownedPoint.Y);
                TimeCounter.Stop();
                TimeElapsed = TimeCounter.Seconds.ToString();
            }
        }