コード例 #1
0
        private void InitExamples()
        {
            textW = new TextW();
            imgW  = new ImgW();
            mouse = new Mouse();

            soloImg = new SoloImg();
            dirImg  = new DirImg();

            extensions = new Extension(".jpg", ".png", ".jpeg", ".bmp");
        }
コード例 #2
0
        public void IfWaterImg(Graphics g, SoloImg soloImg, ImgW imgW)
        {
            Bitmap b = new Bitmap(soloImg.Image.Width, soloImg.Image.Height);

            using (g = Graphics.FromImage(b))
            {
                g.DrawImage(soloImg.Image, 0, 0, soloImg.Image.Width, soloImg.Image.Height);
                g.DrawImage(imgW.ImgWatermark, OriginCoordinate.X, OriginCoordinate.Y, 85, 85);
            }
            b.Save("Copy_ImgW_" + Counter.Count.ToString() + ".bmp");
        }
コード例 #3
0
        public void IfWaterText(Graphics g, SoloImg soloImg, TextW textW)
        {
            Bitmap b = new Bitmap(soloImg.Image.Width, soloImg.Image.Height);

            using (g = Graphics.FromImage(b))
            {
                g.DrawImage(soloImg.Image, 0, 0, soloImg.Image.Width, soloImg.Image.Height);
                g.DrawString(textW.TextWatermark, new Font("Times New Roman", 25, FontStyle.Bold), Brushes.Black, OriginCoordinate.X, OriginCoordinate.Y);
            }
            b.Save("Copy_TextW_" + Counter.Count.ToString() + ".bmp");
        }
コード例 #4
0
        public void AfterSelectFile(Extension extensions, DirImg dirImg, SoloImg soloImg)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string ext = Path.GetExtension(openFileDialog.FileName);
                if (extensions.AllowImageExt.Contains(ext))
                {
                    dirImg.IsFolder   = false;
                    soloImg.PathImage = openFileDialog.FileName;
                }
            }
        }
コード例 #5
0
        public void AfterSelectFolder(DirImg dirImg, Extension extensions, SoloImg soloImg)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                dirImg.Images = new List <Image>();

                DirectoryInfo directoryInfo = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                FileInfo[]    files         = directoryInfo.GetFiles();
                foreach (FileInfo file in files)
                {
                    string ext = Path.GetExtension(file.FullName);
                    if (extensions.AllowImageExt.Contains(ext))
                    {
                        dirImg.Images.Add(Image.FromFile(file.FullName));
                        soloImg.PathImage = file.FullName;
                    }
                }

                dirImg.IsFolder = true;
            }
        }
コード例 #6
0
 public void DrawStart(Graphics g, ToolStripMenuItem textWatermarkBtn, ToolStripMenuItem imageWatermarkBtn, SoloImg soloImg, PictureBox pictureBox1)
 {
     textWatermarkBtn.Enabled  = true;
     imageWatermarkBtn.Enabled = true;
     soloImg.Image             = Image.FromFile(soloImg.PathImage);
     g.DrawImage(soloImg.Image, 0, 0, pictureBox1.Width, pictureBox1.Height);
 }