コード例 #1
0
        private void miGenerateCoatOfArms_Click(object sender, EventArgs e)
        {
            Image image = ImageActionToolbox.RandomlyGenerateCoatOfArms();

            ChangeCurrentImage(image);
            EnableBasedOnImage();
        }
コード例 #2
0
        private void miOpenAndUnderlay_Click(object sender, EventArgs e)
        {
            if (!ImageActionToolbox.UnderlayImage(ref _currentImage, ref _dir))
            {
                return; // abort if error
            }

            ChangeCurrentImage(_currentImage);
        }
コード例 #3
0
        /// <summary> Set the font and color of the font for the watermark </summary>
        private void btnFont_Click(object sender, EventArgs e)
        {
            if (!ImageActionToolbox.SetWatermarkFont(ref _currentWatermarkFont, ref _currentWatermarkColor))
            {
                return; // abort if error
            }

            // Go ahead and demo the font and/or color change to user on Watermark
            txtWaterMark.Font      = _currentWatermarkFont;
            txtWaterMark.ForeColor = _currentWatermarkColor;
        }
コード例 #4
0
        /// <summary> Save the Current Image with the Watermark </summary>
        private void miFileSave_Click(object sender, EventArgs e)
        {
            DialogResult dr = ImageDialogToolbox.ShowSaveDialog(ref _currentFile);

            if ((dr == DialogResult.Cancel) || (dr == DialogResult.Abort))
            {
                return;
            }

            ImageActionToolbox.SaveImage(_currentImage, _currentFile);
            picContainer.Image = Image.FromFile(_currentFile); // reload image from file
            Text = $"Watermark Utility: {_currentFile}";
        }
コード例 #5
0
        /// <summary> Constructor with default configuration settings </summary>
        public FrmCoatOfArms()
        {
            InitializeComponent();

            // setup default settings
            _currentWatermarkColor         = Color.SteelBlue;
            cboOpacity.SelectedIndex       = 2;
            optTop.Checked                 = false;
            optBottom.Checked              = true;
            txtWaterMark.Text              = ImageActionToolbox.WatermarkCopyright();
            _currentWatermarkFont          = txtWaterMark.Font;
            splitContainer1.Panel1.Visible = false;
            DisableBasedOnImage();
        }
コード例 #6
0
        /// <summary> Display the watermark as it would appear after the watermark were saved to the file </summary>
        private void btnPreview_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtWaterMark.Text))
            {
                ShowError("Cannot preview blank text.");
                return;
            }
            else if (FileToolbox.IsJpg(_currentFile))
            {
                MessageBox.Show("Cannot do watermarks on JPG files because JPG does not handle opacity so aborting.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Update the application by reloading the image
            picContainer.Image = ImageActionToolbox.GetImage(_currentFile);

            ImageActionToolbox.DrawWatermark(picContainer.Image, optTop.Checked, txtWaterMark.Text, _currentWatermarkFont, _currentWatermarkColor, picContainer.Top, cboOpacity.Text);
        }
コード例 #7
0
 private void tbCompany_TextChanged(object sender, EventArgs e)
 {
     txtWaterMark.Text = ImageActionToolbox.WatermarkCopyright(tbCompany.Text);
 }
コード例 #8
0
        private void miSwitchColor_Click(object sender, EventArgs e)
        {
            ImageActionToolbox.ChooseToSwitchColor(ref _currentImage);

            ChangeCurrentImage(_currentImage);
        }