private void miGenerateCoatOfArms_Click(object sender, EventArgs e) { Image image = ImageActionToolbox.RandomlyGenerateCoatOfArms(); ChangeCurrentImage(image); EnableBasedOnImage(); }
private void miOpenAndUnderlay_Click(object sender, EventArgs e) { if (!ImageActionToolbox.UnderlayImage(ref _currentImage, ref _dir)) { return; // abort if error } ChangeCurrentImage(_currentImage); }
/// <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; }
/// <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}"; }
/// <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(); }
/// <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); }
private void tbCompany_TextChanged(object sender, EventArgs e) { txtWaterMark.Text = ImageActionToolbox.WatermarkCopyright(tbCompany.Text); }
private void miSwitchColor_Click(object sender, EventArgs e) { ImageActionToolbox.ChooseToSwitchColor(ref _currentImage); ChangeCurrentImage(_currentImage); }