using PaintDotNet.Annotation;
using PaintDotNet.Annotation.Label;
using PaintDotNet.Base.CommTool;
using PaintDotNet.Base.SettingModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PaintDotNet.ImageLabel
{
internal class LabelWaterMarkStyleDialog : PdnBaseForm
{
private Button button2;
private Button button1;
private GroupBox groupBox2;
private GroupBox groupBox3;
private Label label4;
private Label label3;
private Label label2;
private Label label1;
private CustomControl.UserTextBox userTextBox1;
private ComboBox comboBox1;
private Label label5;
private CustomControl.UserTextBox userTextBox2;
private RadioButton radioButton1;
private RadioButton radioButton2;
private TrackBar trackBar1;
private CustomControl.UserTextBox userTextBox3;
private Label label8;
private Label label7;
private Label label6;
private RadioButton radioButton6;
private RadioButton radioButton5;
private RadioButton radioButton4;
private RadioButton radioButton3;
private ComboBox comboBox2;
private Panel panel1;
private Label label9;
private CheckBox checkBox2;
private CheckBox checkBox1;
private Button button3;
private GroupBox groupBox1;
private AppWorkspace appWorkspace;
private DrawObject drawObject;
private ParentStyleModel parentStyleModel;
private WatermarkModel waterMarkModel;
private int nowWaterMarkType = 0;
///
/// 水印位置下拉选
///
string[] position = new string[] { PdnResources.GetString("Menu.Set.Watermarksettings.Topleft.text"),
PdnResources.GetString("Menu.Set.Watermarksettings.Topmiddle.text"), PdnResources.GetString("Menu.Set.Watermarksettings.Topright.text"), PdnResources.GetString("Menu.Set.Watermarksettings.Middleleft.text"), PdnResources.GetString("Menu.nthemiddle.Text"), PdnResources.GetString("Menu.Set.Watermarksettings.Middleright.text"), PdnResources.GetString("Menu.Set.Watermarksettings.Bottomleft.text"), PdnResources.GetString("Menu.Set.Watermarksettings.Bottommiddle.text"), PdnResources.GetString("Menu.Set.Watermarksettings.Bottomright.text") };
///
/// 水印字号下拉选
///
int[] fontSizes = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
private NumericUpDown comboBox3;
///
/// 调色板
///
PaintDotNet.ColorsForm colorsForm;
///
/// 标注列表 水印样式
///
public LabelWaterMarkStyleDialog(AppWorkspace appWorkspace, DrawObject drawObject)
{
this.appWorkspace = appWorkspace;
this.drawObject = drawObject;
this.parentStyleModel = DrawRulerHelper.DeepCopyByReflect(this.drawObject.GetStyle());
InitializeComponent();
InitializeLanguageText();
InitializeControlData();
InitializeWaterMarkModel();
}
private void InitializeLanguageText()
{
this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
this.button2.Text = PdnResources.GetString("Menu.File.Close.Text");
this.button1.Text = PdnResources.GetString("Menu.application.text");
this.groupBox2.Text = PdnResources.GetString("Menu.Set.Watermarksettings.BasicInformation.text");
this.radioButton2.Text = PdnResources.GetString("Menu.no.text");
this.radioButton1.Text = PdnResources.GetString("Menu.Yes.text");
this.label5.Text = PdnResources.GetString("Menu.Set.Watermarksettings.Fromtheboundaryvalue.text") + ":";
this.label4.Text = PdnResources.GetString("Menu.transparency.text") + ":";
this.label3.Text = PdnResources.GetString("Menu.Set.Watermarksettings.Tilewatermark.text") + ":";
this.label2.Text = PdnResources.GetString("Menu.Set.Watermarksettings.Watermarkposition.text") + ":";
this.label1.Text = PdnResources.GetString("Menu.LabelAction.DrawWaterMark.Text") + ":";
this.button3.Text = PdnResources.GetString("Menu.browse.Text");
this.groupBox3.Text = PdnResources.GetString("Menu.Set.Watermarksettings.ExtendInformation.text");
this.checkBox2.Text = PdnResources.GetString("Menu.Set.Watermarksettings.Italic.text");
this.checkBox1.Text = PdnResources.GetString("Menu.Set.Watermarksettings.Bold.text");
this.label9.Text = PdnResources.GetString("Menu.Fontsize.text") + ":";
this.radioButton6.Text = PdnResources.GetString("Menu.Set.Watermarksettings.backwardlean.text");
this.radioButton5.Text = PdnResources.GetString("Menu.Set.Watermarksettings.battering.text");
this.radioButton4.Text = PdnResources.GetString("Menu.Verticaldirection.text");
this.radioButton3.Text = PdnResources.GetString("Menu.horizontaldirection.text");
this.label8.Text = PdnResources.GetString("Menu.color.text") + ":";
this.label7.Text = PdnResources.GetString("Menu.Font.text") + ":";
this.label6.Text = PdnResources.GetString("Menu.direction.text") + ":";
this.Text = PdnResources.GetString("Menu.Setting.WatermarkSetting.Text");
}
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.userTextBox3 = new PaintDotNet.CustomControl.UserTextBox();
this.trackBar1 = new System.Windows.Forms.TrackBar();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.userTextBox2 = new PaintDotNet.CustomControl.UserTextBox();
this.label5 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.userTextBox1 = new PaintDotNet.CustomControl.UserTextBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label9 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.radioButton6 = new System.Windows.Forms.RadioButton();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.comboBox3 = new System.Windows.Forms.NumericUpDown();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBox3)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(613, 52);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "操作";
//
// button2
//
this.button2.Location = new System.Drawing.Point(504, 20);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "关闭";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(389, 20);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "应用";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.userTextBox3);
this.groupBox2.Controls.Add(this.trackBar1);
this.groupBox2.Controls.Add(this.radioButton2);
this.groupBox2.Controls.Add(this.radioButton1);
this.groupBox2.Controls.Add(this.userTextBox2);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.comboBox1);
this.groupBox2.Controls.Add(this.userTextBox1);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.button3);
this.groupBox2.Location = new System.Drawing.Point(12, 70);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(613, 167);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "基本信息";
//
// userTextBox3
//
this.userTextBox3.BackColor = System.Drawing.SystemColors.Control;
this.userTextBox3.Location = new System.Drawing.Point(363, 117);
this.userTextBox3.Name = "userTextBox3";
this.userTextBox3.ReadOnly = true;
this.userTextBox3.Size = new System.Drawing.Size(46, 21);
this.userTextBox3.TabIndex = 11;
this.userTextBox3.Text = "0";
//
// trackBar1
//
this.trackBar1.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar1.Location = new System.Drawing.Point(77, 117);
this.trackBar1.Maximum = 255;
this.trackBar1.Name = "trackBar1";
this.trackBar1.Size = new System.Drawing.Size(262, 45);
this.trackBar1.TabIndex = 10;
this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(161, 90);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(35, 16);
this.radioButton2.TabIndex = 9;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "否";
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(90, 90);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(35, 16);
this.radioButton1.TabIndex = 8;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "是";
this.radioButton1.UseVisualStyleBackColor = true;
//
// userTextBox2
//
this.userTextBox2.Location = new System.Drawing.Point(372, 53);
this.userTextBox2.Name = "userTextBox2";
this.userTextBox2.Size = new System.Drawing.Size(223, 21);
this.userTextBox2.TabIndex = 7;
this.userTextBox2.TextChanged += new System.EventHandler(this.userTextBox2_TextChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(303, 56);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(65, 12);
this.label5.TabIndex = 6;
this.label5.Text = "距边界值:";
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.DropDownWidth = 197;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(87, 51);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(197, 20);
this.comboBox1.TabIndex = 5;
//
// userTextBox1
//
this.userTextBox1.Location = new System.Drawing.Point(87, 15);
this.userTextBox1.Name = "userTextBox1";
this.userTextBox1.Size = new System.Drawing.Size(508, 21);
this.userTextBox1.TabIndex = 4;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(18, 122);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 12);
this.label4.TabIndex = 3;
this.label4.Text = "透明度:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(18, 90);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 2;
this.label3.Text = "平铺水印:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(18, 54);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 1;
this.label2.Text = "水印位置:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(18, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 0;
this.label1.Text = "水印:";
//
// button3
//
this.button3.Location = new System.Drawing.Point(520, 14);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 12;
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.comboBox3);
this.groupBox3.Controls.Add(this.checkBox2);
this.groupBox3.Controls.Add(this.checkBox1);
this.groupBox3.Controls.Add(this.label9);
this.groupBox3.Controls.Add(this.panel1);
this.groupBox3.Controls.Add(this.comboBox2);
this.groupBox3.Controls.Add(this.radioButton6);
this.groupBox3.Controls.Add(this.radioButton5);
this.groupBox3.Controls.Add(this.radioButton4);
this.groupBox3.Controls.Add(this.radioButton3);
this.groupBox3.Controls.Add(this.label8);
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Controls.Add(this.label6);
this.groupBox3.Location = new System.Drawing.Point(12, 245);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(613, 118);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "扩展信息";
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(403, 85);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(48, 16);
this.checkBox2.TabIndex = 12;
this.checkBox2.Text = "斜体";
this.checkBox2.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(330, 86);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(48, 16);
this.checkBox1.TabIndex = 11;
this.checkBox1.Text = "粗体";
this.checkBox1.UseVisualStyleBackColor = true;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(328, 53);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(41, 12);
this.label9.TabIndex = 9;
this.label9.Text = "字号:";
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Location = new System.Drawing.Point(68, 83);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(191, 21);
this.panel1.TabIndex = 8;
this.panel1.Click += new System.EventHandler(this.panel1_Click);
//
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(68, 49);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(191, 20);
this.comboBox2.TabIndex = 7;
//
// radioButton6
//
this.radioButton6.AutoSize = true;
this.radioButton6.Location = new System.Drawing.Point(299, 20);
this.radioButton6.Name = "radioButton6";
this.radioButton6.Size = new System.Drawing.Size(71, 16);
this.radioButton6.TabIndex = 6;
this.radioButton6.TabStop = true;
this.radioButton6.Text = "向后倾斜";
this.radioButton6.UseVisualStyleBackColor = true;
//
// radioButton5
//
this.radioButton5.AutoSize = true;
this.radioButton5.Location = new System.Drawing.Point(222, 20);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(71, 16);
this.radioButton5.TabIndex = 5;
this.radioButton5.TabStop = true;
this.radioButton5.Text = "向前倾斜";
this.radioButton5.UseVisualStyleBackColor = true;
//
// radioButton4
//
this.radioButton4.AutoSize = true;
this.radioButton4.Location = new System.Drawing.Point(145, 20);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(71, 16);
this.radioButton4.TabIndex = 4;
this.radioButton4.TabStop = true;
this.radioButton4.Text = "垂直方向";
this.radioButton4.UseVisualStyleBackColor = true;
//
// radioButton3
//
this.radioButton3.AutoSize = true;
this.radioButton3.Checked = true;
this.radioButton3.Location = new System.Drawing.Point(68, 20);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(71, 16);
this.radioButton3.TabIndex = 3;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "水平方向";
this.radioButton3.UseVisualStyleBackColor = true;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(21, 85);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(41, 12);
this.label8.TabIndex = 2;
this.label8.Text = "颜色:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(21, 53);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(41, 12);
this.label7.TabIndex = 1;
this.label7.Text = "字体:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(21, 22);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(41, 12);
this.label6.TabIndex = 0;
this.label6.Text = "方向:";
//
// comboBox3
//
this.comboBox3.Location = new System.Drawing.Point(372, 49);
this.comboBox3.Maximum = new decimal(new int[] {
49000,
0,
0,
0});
this.comboBox3.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.comboBox3.Name = "comboBox3";
this.comboBox3.Size = new System.Drawing.Size(223, 21);
this.comboBox3.TabIndex = 21;
this.comboBox3.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// LabelWaterMarkStyleDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.ClientSize = new System.Drawing.Size(637, 375);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LabelWaterMarkStyleDialog";
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.groupBox2, 0);
this.Controls.SetChildIndex(this.groupBox3, 0);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBox3)).EndInit();
this.ResumeLayout(false);
}
///
/// 关闭
///
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 初始化数据
///
private void InitializeControlData()
{
//绑定字体下拉
ArrayList fontsItems = new ArrayList();
System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
foreach (FontFamily fontFamily in fonts.Families)
{
fontsItems.Add(fontFamily.Name);
}
this.comboBox2.DataSource = fontsItems;
//绑定水印位置下拉
this.comboBox1.DataSource = position;
//绑定字号下拉
//this.comboBox3.DataSource = fontSizes;
this.colorsForm = new ColorsForm();
this.colorsForm.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
}
///
/// 初始化水印样式信息
///
private void InitializeWaterMarkModel()
{
waterMarkModel = (WatermarkModel)this.parentStyleModel;
this.userTextBox1.Text = waterMarkModel.content;
this.comboBox1.SelectedIndex = waterMarkModel.position - 1;
this.userTextBox2.Text = waterMarkModel.margin + "";
// 平铺水印
if (waterMarkModel.spread == 2)
{
this.radioButton2.Checked = true;
}
else
{
this.radioButton1.Checked = true;
}
this.trackBar1.Value = waterMarkModel.transparency;
this.userTextBox3.Text = waterMarkModel.transparency + "";
switch (waterMarkModel.direction)
{
case 1:
this.radioButton3.Checked = true;
break;
case 2:
this.radioButton4.Checked = true;
break;
case 3:
this.radioButton5.Checked = true;
break;
case 4:
this.radioButton6.Checked = true;
break;
default:
this.radioButton3.Checked = true;
break;
}
this.comboBox2.Text = waterMarkModel.typeface;
this.comboBox3.Value = decimal.Parse(waterMarkModel.fontSize + "");
this.panel1.BackColor = Color.FromArgb(waterMarkModel.color);
if (waterMarkModel.bold == 1)
{
this.checkBox1.Checked = true;
}
if (waterMarkModel.italic == 1)
{
this.checkBox2.Checked = true;
}
//文字水印的窗体变更
if (waterMarkModel.watermarkType == 1)
{
this.userTextBox1.ReadOnly = false;
this.userTextBox1.Size = new Size(508, 21);
this.button3.Visible = false;
this.groupBox3.Visible = true;//扩展信息
this.nowWaterMarkType = 1;
}
//图片水印的窗体变更
if (waterMarkModel.watermarkType == 2)
{
this.userTextBox1.ReadOnly = true;
this.userTextBox1.Size = new Size(508 - 85, 21);
this.button3.Visible = true;
this.groupBox3.Visible = false;
this.nowWaterMarkType = 2;
}
}
///
/// 选择图片水印
///
///
///
private void button3_Click(object sender, EventArgs e)
{
var openFileDialog1 = new OpenFileDialog { Filter = "*.jpg,*jpeg,*.bmp,*.ico,*.png,*.tif,*.wmf|*.jpg;*jpeg;*.bmp;*.ico;*.png;*.tif;*.wmf" };
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
this.userTextBox1.Text = openFileDialog1.InitialDirectory + openFileDialog1.FileName;
}
}
///
/// 透明度滑块
///
///
///
private void trackBar1_Scroll(object sender, EventArgs e)
{
this.userTextBox3.Text = "" + this.trackBar1.Value;
}
///
/// 画板点击
///
///
///
private void panel1_Click(object sender, EventArgs e)
{
this.colorsForm.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
this.colorsForm.setSaveBtn_Click(new System.EventHandler(this.panel1Changed));
this.colorsForm.ShowDialog();
}
private void panel1Changed(object sender, EventArgs e)
{
this.panel1.BackColor = this.colorsForm.UserPrimaryColor.ToColor();
this.colorsForm.Close();
}
private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
{
}
///
/// 距边界值
///
///
///
private void userTextBox2_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.userTextBox2.Text))
{
MessageBox.Show(PdnResources.GetString("Menu.edistancefromtheboundaryaluecanno.Text"));
return;
}
}
///
/// 应用
///
///
///
private void button1_Click(object sender, EventArgs e)
{
waterMarkModel = new WatermarkModel();
waterMarkModel.watermarkType = this.nowWaterMarkType;
waterMarkModel.content = this.userTextBox1.Text;
waterMarkModel.position = this.comboBox1.SelectedIndex + 1;
if (string.IsNullOrEmpty(this.userTextBox2.Text))
{
waterMarkModel.margin = 0;
}
else
{
waterMarkModel.margin = Int32.Parse(this.userTextBox2.Text);
}
if (this.radioButton2.Checked)
{
waterMarkModel.spread = 2;
}
else
{
waterMarkModel.spread = 1;
}
waterMarkModel.transparency = this.trackBar1.Value;
if (radioButton3.Checked)
{
waterMarkModel.direction = 1;
}
else if (radioButton4.Checked)
{
waterMarkModel.direction = 2;
}
else if (radioButton5.Checked)
{
waterMarkModel.direction = 3;
}
else
{
waterMarkModel.direction = 4;
}
waterMarkModel.typeface = this.comboBox2.Text;
waterMarkModel.fontSize = Convert.ToInt32(this.comboBox3.Text);
waterMarkModel.color = Convert.ToInt32(this.panel1.BackColor.ToArgb());
if (this.checkBox1.Checked)
{
waterMarkModel.bold = 1;
}
else
{
waterMarkModel.bold = 2;
}
if (this.checkBox2.Checked)
{
waterMarkModel.italic = 1;
}
else
{
waterMarkModel.italic = 2;
}
DrawWaterMark drawWaterMark = (DrawWaterMark)this.drawObject;
drawWaterMark.waterMarkModel = this.waterMarkModel;
this.appWorkspace.ActiveDocumentWorkspace.Refresh();
this.Close();
}
}
}