using PaintDotNet.CustomControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace PaintDotNet.DedicatedAnalysis.NonferrousMetals.YYT098814_2016
{
///
/// 组织界面梯度法
///
internal class TABMethod4DialogSetting : PdnBaseForm
{
#region 基础控件
private Button button2;
private GroupBox groupBox3;
private ImageList imageList1;
private IContainer components;
private GroupBox groupBox1;
#endregion
///
/// 调色板
///
PaintDotNet.ColorsForm colorsForm1;
PaintDotNet.ColorsForm colorsForm2;
PaintDotNet.ColorsForm colorsForm3;
PaintDotNet.ColorsForm colorsForm4;
PaintDotNet.ColorsForm colorsForm5;
///
/// 主控件
///
private AppWorkspace appWorkspace;
///
/// 图像面板
///
private DocumentWorkspaceWindow documentWorkspace;
///
/// 公共按钮
///
private CommonControlButtons commonControlButtons;
///
/// 检测到的轮廓
///
OpenCvSharp.Point[][] contours;
///
/// 选中图片的bitmap
///
private Bitmap bitmap;
///
/// 选择标尺的物理长度(微米/像素)
///
double physical_length = 1;
///
/// 图像的物理长度
///
int physical_width = 1200;
///
/// 0:添加 1:选择 2:删除
///
private int operationK = -1;
///
/// 被选择的线
///
private int selected = -1;
///
/// 起止点
///
private System.Drawing.PointF startPoint, endPoint;
///
/// 存储所有线的点集合
///
private List pointList = new List();
///
/// 测量点
///
public List rectangleFList = new List();
///
/// 存储当前线的点集合
///
private PointF[] nowLine;
///
/// 线的总数
///
private int lineCount = 0;
///
/// 计算结果的表格集合
///
private List resultTableList = new List();
///
/// 保存用于生成报告的图片
///
private List bitList;
///
/// 储存点击保存结果后的所有原图与分析图
///
private Dictionary> bitDic = new Dictionary>();
///
/// 是否显示全部
///
private bool showAll = false;
///
/// 辅助计算偏移量-移动线两端的点
///
private PointF lastPoint = new PointF(0, 0);
///
/// 辅助计算偏移量-移动线中间的点
///
private PointF tempPoint = new PointF(0, 0);
///
/// 判断图形是否可移动
///
private bool canMove = false;
///
/// 调色板
///
private ColorsForm colorsFormGrid;
private Panel panelC;
private Button button10;
private GroupBox groupBox6;
private Panel panel3;
private TrackBar trackBar4;
private TextBox textBox10;
private Label label4;
private Label label6;
private GroupBox groupBox2;
private Panel panel6;
private TrackBar trackBar1;
private TextBox textBox1;
private Label label8;
private Label label9;
private Panel panel9;
private TrackBar trackBar6;
private TextBox textBox6;
private Label label13;
private Label label14;
private Panel panel8;
private TrackBar trackBar5;
private TextBox textBox4;
private Label label11;
private Label label12;
private Panel panel1;
private TrackBar trackBar2;
private TextBox textBox2;
private Label label3;
private Label label5;
private GroupBox groupBox4;
private Panel panel7;
private TextBox textBox3;
private TrackBar trackBar3;
private TextBox textBox5;
private Label label10;
private Label label16;
private Label label18;
private GroupBox groupBox7;
private Panel panel4;
private TrackBar trackBar7;
private TextBox textBox9;
private Label label1;
private Label label2;
///
/// 移动线上的哪一个点
///
private int movePointIndex = -1;
private GroupBox groupBox5;
private Panel panel2;
private TrackBar trackBar8;
private TextBox textBox7;
private Label label7;
private Label label15;
private TABM4Dialog parentDialog;
public TABMethod4DialogSetting(TABM4Dialog parent, AppWorkspace appWorkspace, int focusedItemIndex)
{
this.parentDialog = parent;
this.appWorkspace = appWorkspace;
InitializeComponent();
InitializeLanguageText();
//
//初始化色板
//
this.colorsFormGrid = new ColorsForm();
this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
InitOtherTools();
if (focusedItemIndex > -1)
{
this.bitmap = new Bitmap(1200, 900, PixelFormat.Format32bppRgb/*Format32bppArgb*/);
Bitmap bitmap11 = this.appWorkspace.DocumentWorkspaces[focusedItemIndex].CompositionSurface.CreateAliasedBitmap();
//Dictionary measurementUnitDictionary = Startup.instance.rules;
double physical_length11 = this.appWorkspace.DocumentWorkspaces[focusedItemIndex].GetRuler(MeasurementUnit.Micron);
//double physical_length11 = measurementUnitDictionary[MeasurementUnit.Micron];
physical_width = (int)(bitmap11.Width * physical_length11);
}
else
this.bitmap = new Bitmap(1200, 900, PixelFormat.Format32bppRgb/*Format32bppArgb*/);
//this.bitmap = new Bitmap(1200, 900, PixelFormat.Format32bppRgb/*Format32bppArgb*/);// this.appWorkspace.DocumentWorkspaces[focusedItemIndex].CompositionSurface.CreateAliasedBitmap();
Document document = Document.FromImage(bitmap);
this.documentWorkspace.Document = document;
this.documentWorkspace.Visible = true;
InitCommonButtonEvent();
AddPictureBoxEvent();
InitVariableParams();
}
///
/// 限制只可以输入0-9数字以及退格键
///
///
///
private void textBoxWidth_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != '\b')//这是允许输入退格键
{
int len = ((TextBox)sender)/*this.textBox1*/.Text.Length;
if (len < 1 && e.KeyChar == '0')
{
e.Handled = true;
}
else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字
{
e.Handled = true;
}
}
}
private void InitVariableParams()
{
this.trackBar8.Value = this.parentDialog.rectLineWidth;
this.textBox7.Text = this.trackBar8.Value.ToString();
this.trackBar1.Value = this.parentDialog.baseLineWidth;
this.textBox1.Text = this.trackBar1.Value.ToString();
this.trackBar3.Value = this.parentDialog.scopeLineWidth;
this.textBox5.Text = this.trackBar3.Value.ToString();
this.trackBar4.Value = this.parentDialog.orgLineWidth;
this.textBox10.Text = this.trackBar4.Value.ToString();
this.trackBar2.Value = this.parentDialog.rect1LineWidth;
this.textBox2.Text = this.trackBar2.Value.ToString();
this.trackBar5.Value = this.parentDialog.rect2LineWidth;
this.textBox4.Text = this.trackBar5.Value.ToString();
this.trackBar6.Value = this.parentDialog.rect3LineWidth;
this.textBox6.Text = this.trackBar6.Value.ToString();
this.trackBar7.Value = this.parentDialog.assistLineWidth;
this.textBox9.Text = this.trackBar7.Value.ToString();
this.textBox3.Text = parentDialog.scopeMarginLeft/*this.trackBar7.Value*/.ToString();
this.panel2.BackColor = this.parentDialog.rectLineColor;
this.panel6.BackColor = this.parentDialog.baseLineColor;
this.panel7.BackColor = this.parentDialog.scopeLineColor;
this.panel3.BackColor = this.parentDialog.orgLineColor;
this.panel1.BackColor = this.parentDialog.rect1LineColor;
this.panel8.BackColor = this.parentDialog.rect2LineColor;
this.panel9.BackColor = this.parentDialog.rect3LineColor;
this.panel4.BackColor = this.parentDialog.assistLineColor;
}
private void InitializeLanguageText()
{
this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
this.button10.Text = PdnResources.GetString("Menu.File.Close.Text");
this.button2.Text = PdnResources.GetString("CommonAction.Save");
this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");
this.groupBox5.Text = "轮廓线设置";
this.label15.Text = "轮廓线颜色" + ":";
this.label7.Text = "轮廓线线宽" + ":";
this.groupBox6.Text = "区域线设置";// PdnResources.GetString("Menu.Organizationlinesettings.text");
this.label13.Text = PdnResources.GetString("Menu.realinewidth.Text") + ":";
this.label14.Text = PdnResources.GetString("Menu.realinewcolor.Text") + ":";
this.label11.Text = PdnResources.GetString("Menu.realin2ewcolor.Text") + ":";
this.label12.Text = PdnResources.GetString("Menu.realin2ss.Text") + ":";
this.label3.Text = PdnResources.GetString("Menu.Linewidthofarea1.text") + ":";
this.label5.Text = PdnResources.GetString("Menu.Linecolorofarea1.text") + ":";
this.label4.Text = PdnResources.GetString("Menu.Organizationlinewidth.text") + ":";
this.label6.Text = PdnResources.GetString("Menu.Organizationlinecolor.text") + ":";
this.groupBox2.Text = PdnResources.GetString("Menu.Baselinesettings.text");
this.label8.Text = PdnResources.GetString("Menu.Baselinewidth.text") + ":";
this.label9.Text = PdnResources.GetString("Menu.Baselinecolor.text") + ":";
this.groupBox4.Text = PdnResources.GetString("Menu.Rangesetting.text");
this.label10.Text = PdnResources.GetString("Menu.Distancefromtherangelinetotheboundary.text") + ":";
this.label16.Text = PdnResources.GetString("Menu.Rangelinewidth.text") + ":";
this.label18.Text = PdnResources.GetString("Menu.Rangelinecolor.text") + ":";
this.groupBox7.Text = PdnResources.GetString("Menu.Auxiliarylinesettings.text");
this.label1.Text = PdnResources.GetString("Menu.Auxiliarylinewidth.text") + ":";
this.label2.Text = PdnResources.GetString("Menu.Auxiliarylinecolor.text") + ":";
this.Text = PdnResources.GetString("Menu.Organizationdefinesmoresettings.text");
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button10 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.panel9 = new System.Windows.Forms.Panel();
this.trackBar6 = new System.Windows.Forms.TrackBar();
this.textBox6 = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.panel8 = new System.Windows.Forms.Panel();
this.trackBar5 = new System.Windows.Forms.TrackBar();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.trackBar2 = new System.Windows.Forms.TrackBar();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.trackBar4 = new System.Windows.Forms.TrackBar();
this.textBox10 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.panel6 = new System.Windows.Forms.Panel();
this.trackBar1 = new System.Windows.Forms.TrackBar();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.panel7 = new System.Windows.Forms.Panel();
this.textBox3 = new System.Windows.Forms.TextBox();
this.trackBar3 = new System.Windows.Forms.TrackBar();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.panel4 = new System.Windows.Forms.Panel();
this.trackBar7 = new System.Windows.Forms.TrackBar();
this.textBox9 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.panel2 = new System.Windows.Forms.Panel();
this.trackBar8 = new System.Windows.Forms.TrackBar();
this.textBox7 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).BeginInit();
this.groupBox7.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar7)).BeginInit();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar8)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.button10);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Location = new System.Drawing.Point(14, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(847, 50);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
//
// button10
//
this.button10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.button10.Location = new System.Drawing.Point(661, 14);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(84, 30);
this.button10.TabIndex = 3;
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.button10_Click);
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(751, 14);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(84, 30);
this.button2.TabIndex = 2;
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// imageList1
//
this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Location = new System.Drawing.Point(387, 60);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(475, 385);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
//
// groupBox6
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.panel9);
this.groupBox6.Controls.Add(this.trackBar6);
this.groupBox6.Controls.Add(this.textBox6);
this.groupBox6.Controls.Add(this.label13);
this.groupBox6.Controls.Add(this.label14);
this.groupBox6.Controls.Add(this.panel8);
this.groupBox6.Controls.Add(this.trackBar5);
this.groupBox6.Controls.Add(this.textBox4);
this.groupBox6.Controls.Add(this.label11);
this.groupBox6.Controls.Add(this.label12);
this.groupBox6.Controls.Add(this.panel1);
this.groupBox6.Controls.Add(this.trackBar2);
this.groupBox6.Controls.Add(this.textBox2);
this.groupBox6.Controls.Add(this.label3);
this.groupBox6.Controls.Add(this.label5);
this.groupBox6.Controls.Add(this.panel3);
this.groupBox6.Controls.Add(this.trackBar4);
this.groupBox6.Controls.Add(this.textBox10);
this.groupBox6.Controls.Add(this.label4);
this.groupBox6.Controls.Add(this.label6);
this.groupBox6.Location = new System.Drawing.Point(14, 202);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(353, 122);
this.groupBox6.TabIndex = 15;
this.groupBox6.TabStop = false;
//
// panel9
//
this.panel9.BackColor = System.Drawing.Color.DarkSeaGreen;
this.panel9.Location = new System.Drawing.Point(104, 93);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(40, 21);
this.panel9.TabIndex = 37;
this.panel9.Click += new System.EventHandler(this.panel6_Click);
//
// trackBar6
//
this.trackBar6.AutoSize = false;
this.trackBar6.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar6.Location = new System.Drawing.Point(227, 94);
this.trackBar6.Maximum = 50;
this.trackBar6.Minimum = 1;
this.trackBar6.Name = "trackBar6";
this.trackBar6.Size = new System.Drawing.Size(71, 21);
this.trackBar6.TabIndex = 36;
this.trackBar6.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar6.Value = 3;
this.trackBar6.Scroll += new System.EventHandler(this.trackBar6_Scroll);
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(304, 93);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(35, 21);
this.textBox6.TabIndex = 35;
this.textBox6.Text = "3";
this.textBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox6.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox6_KeyUp);
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(150, 98);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(0, 12);
this.label13.TabIndex = 34;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(15, 98);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(0, 12);
this.label14.TabIndex = 33;
//
// panel8
//
this.panel8.BackColor = System.Drawing.Color.YellowGreen;
this.panel8.Location = new System.Drawing.Point(104, 68);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(40, 21);
this.panel8.TabIndex = 32;
this.panel8.Click += new System.EventHandler(this.panel6_Click);
//
// trackBar5
//
this.trackBar5.AutoSize = false;
this.trackBar5.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar5.Location = new System.Drawing.Point(227, 69);
this.trackBar5.Maximum = 50;
this.trackBar5.Minimum = 1;
this.trackBar5.Name = "trackBar5";
this.trackBar5.Size = new System.Drawing.Size(71, 21);
this.trackBar5.TabIndex = 31;
this.trackBar5.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar5.Value = 3;
this.trackBar5.Scroll += new System.EventHandler(this.trackBar5_Scroll);
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(304, 68);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(35, 21);
this.textBox4.TabIndex = 30;
this.textBox4.Text = "3";
this.textBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox4.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox4_KeyUp);
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(150, 73);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(0, 12);
this.label11.TabIndex = 29;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(15, 73);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(0, 12);
this.label12.TabIndex = 28;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.MediumSpringGreen;
this.panel1.Location = new System.Drawing.Point(104, 43);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(40, 21);
this.panel1.TabIndex = 27;
this.panel1.Click += new System.EventHandler(this.panel6_Click);
//
// trackBar2
//
this.trackBar2.AutoSize = false;
this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar2.Location = new System.Drawing.Point(227, 44);
this.trackBar2.Maximum = 50;
this.trackBar2.Minimum = 1;
this.trackBar2.Name = "trackBar2";
this.trackBar2.Size = new System.Drawing.Size(71, 21);
this.trackBar2.TabIndex = 26;
this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar2.Value = 3;
this.trackBar2.Scroll += new System.EventHandler(this.trackBar2_Scroll);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(304, 43);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(35, 21);
this.textBox2.TabIndex = 25;
this.textBox2.Text = "3";
this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox2.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox2_KeyUp);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(150, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(0, 12);
this.label3.TabIndex = 24;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(15, 48);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(0, 12);
this.label5.TabIndex = 23;
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.LightCoral;
this.panel3.Location = new System.Drawing.Point(104, 19);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(40, 21);
this.panel3.TabIndex = 22;
this.panel3.Click += new System.EventHandler(this.panel6_Click);
//
// trackBar4
//
this.trackBar4.AutoSize = false;
this.trackBar4.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar4.Location = new System.Drawing.Point(227, 20);
this.trackBar4.Maximum = 50;
this.trackBar4.Minimum = 1;
this.trackBar4.Name = "trackBar4";
this.trackBar4.Size = new System.Drawing.Size(71, 21);
this.trackBar4.TabIndex = 7;
this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar4.Value = 3;
this.trackBar4.Scroll += new System.EventHandler(this.trackBar4_Scroll);
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(304, 19);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(35, 21);
this.textBox10.TabIndex = 6;
this.textBox10.Text = "3";
this.textBox10.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox10.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox10_KeyUp);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(150, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(0, 12);
this.label4.TabIndex = 2;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(15, 24);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(0, 12);
this.label6.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.panel6);
this.groupBox2.Controls.Add(this.trackBar1);
this.groupBox2.Controls.Add(this.textBox1);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Location = new System.Drawing.Point(14, 393);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(353, 52);
this.groupBox2.TabIndex = 22;
this.groupBox2.TabStop = false;
//
// panel6
//
this.panel6.BackColor = System.Drawing.Color.Yellow;
this.panel6.Location = new System.Drawing.Point(88, 18);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(45, 21);
this.panel6.TabIndex = 22;
this.panel6.Click += new System.EventHandler(this.panel6_Click);
//
// trackBar1
//
this.trackBar1.AutoSize = false;
this.trackBar1.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar1.Location = new System.Drawing.Point(214, 20);
this.trackBar1.Maximum = 50;
this.trackBar1.Minimum = 1;
this.trackBar1.Name = "trackBar1";
this.trackBar1.Size = new System.Drawing.Size(84, 21);
this.trackBar1.TabIndex = 7;
this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar1.Value = 3;
this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(304, 19);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(35, 21);
this.textBox1.TabIndex = 6;
this.textBox1.Text = "3";
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox1.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyUp);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(151, 24);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(0, 12);
this.label8.TabIndex = 2;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(15, 24);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(0, 12);
this.label9.TabIndex = 0;
//
// groupBox4
//
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox4.Controls.Add(this.panel7);
this.groupBox4.Controls.Add(this.textBox3);
this.groupBox4.Controls.Add(this.trackBar3);
this.groupBox4.Controls.Add(this.textBox5);
this.groupBox4.Controls.Add(this.label10);
this.groupBox4.Controls.Add(this.label16);
this.groupBox4.Controls.Add(this.label18);
this.groupBox4.Location = new System.Drawing.Point(14, 117);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(353, 79);
this.groupBox4.TabIndex = 23;
this.groupBox4.TabStop = false;
//
// panel7
//
this.panel7.BackColor = System.Drawing.Color.Red;
this.panel7.Location = new System.Drawing.Point(88, 19);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(45, 21);
this.panel7.TabIndex = 23;
this.panel7.Click += new System.EventHandler(this.panel6_Click);
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(134, 47);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(121, 21);
this.textBox3.TabIndex = 8;
this.textBox3.Text = "25";
this.textBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox3.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox3_KeyUp);
//
// trackBar3
//
this.trackBar3.AutoSize = false;
this.trackBar3.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar3.Location = new System.Drawing.Point(214, 20);
this.trackBar3.Maximum = 50;
this.trackBar3.Minimum = 1;
this.trackBar3.Name = "trackBar3";
this.trackBar3.Size = new System.Drawing.Size(84, 21);
this.trackBar3.TabIndex = 7;
this.trackBar3.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar3.Value = 3;
this.trackBar3.Scroll += new System.EventHandler(this.trackBar3_Scroll);
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(304, 19);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(35, 21);
this.textBox5.TabIndex = 6;
this.textBox5.Text = "3";
this.textBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox5.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox5_KeyUp);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(15, 51);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(0, 12);
this.label10.TabIndex = 3;
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(139, 24);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(0, 12);
this.label16.TabIndex = 2;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(15, 24);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(0, 12);
this.label18.TabIndex = 0;
//
// groupBox7
//
this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox7.Controls.Add(this.panel4);
this.groupBox7.Controls.Add(this.trackBar7);
this.groupBox7.Controls.Add(this.textBox9);
this.groupBox7.Controls.Add(this.label1);
this.groupBox7.Controls.Add(this.label2);
this.groupBox7.Location = new System.Drawing.Point(14, 331);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(353, 56);
this.groupBox7.TabIndex = 24;
this.groupBox7.TabStop = false;
//
// panel4
//
this.panel4.BackColor = System.Drawing.Color.ForestGreen;
this.panel4.Location = new System.Drawing.Point(104, 19);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(40, 21);
this.panel4.TabIndex = 23;
this.panel4.Click += new System.EventHandler(this.panel6_Click);
//
// trackBar7
//
this.trackBar7.AutoSize = false;
this.trackBar7.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar7.Location = new System.Drawing.Point(227, 20);
this.trackBar7.Maximum = 50;
this.trackBar7.Minimum = 1;
this.trackBar7.Name = "trackBar7";
this.trackBar7.Size = new System.Drawing.Size(71, 21);
this.trackBar7.TabIndex = 7;
this.trackBar7.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar7.Value = 3;
this.trackBar7.Scroll += new System.EventHandler(this.trackBar7_Scroll);
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(304, 19);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(35, 21);
this.textBox9.TabIndex = 6;
this.textBox9.Text = "3";
this.textBox9.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox9.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox9_KeyUp);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(150, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 12);
this.label1.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(0, 12);
this.label2.TabIndex = 0;
//
// groupBox5
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.panel2);
this.groupBox5.Controls.Add(this.trackBar8);
this.groupBox5.Controls.Add(this.textBox7);
this.groupBox5.Controls.Add(this.label7);
this.groupBox5.Controls.Add(this.label15);
this.groupBox5.Location = new System.Drawing.Point(14, 59);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(353, 52);
this.groupBox5.TabIndex = 23;
this.groupBox5.TabStop = false;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.IndianRed;
this.panel2.Location = new System.Drawing.Point(88, 18);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(45, 21);
this.panel2.TabIndex = 22;
this.panel2.Click += new System.EventHandler(this.panel6_Click);
//
// trackBar8
//
this.trackBar8.AutoSize = false;
this.trackBar8.Cursor = System.Windows.Forms.Cursors.Hand;
this.trackBar8.Location = new System.Drawing.Point(214, 20);
this.trackBar8.Maximum = 50;
this.trackBar8.Minimum = 1;
this.trackBar8.Name = "trackBar8";
this.trackBar8.Size = new System.Drawing.Size(84, 21);
this.trackBar8.TabIndex = 7;
this.trackBar8.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBar8.Value = 3;
this.trackBar8.Scroll += new System.EventHandler(this.trackBar8_Scroll);
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(304, 19);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(35, 21);
this.textBox7.TabIndex = 6;
this.textBox7.Text = "3";
this.textBox7.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
this.textBox7.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox7_KeyUp);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(151, 24);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(0, 12);
this.label7.TabIndex = 2;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(15, 24);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(0, 12);
this.label15.TabIndex = 0;
//
// TABMethod4DialogSetting
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.ClientSize = new System.Drawing.Size(874, 457);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox7);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TABMethod4DialogSetting";
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.groupBox3, 0);
this.Controls.SetChildIndex(this.groupBox6, 0);
this.Controls.SetChildIndex(this.groupBox2, 0);
this.Controls.SetChildIndex(this.groupBox4, 0);
this.Controls.SetChildIndex(this.groupBox7, 0);
this.Controls.SetChildIndex(this.groupBox5, 0);
this.groupBox1.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).EndInit();
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar7)).EndInit();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar8)).EndInit();
this.ResumeLayout(false);
}
///
/// 初始化其他控件
///
private void InitOtherTools()
{
//
//初始化图像控件
//
this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
this.documentWorkspace.Dock = DockStyle.Fill;
this.documentWorkspace.HookMouseEvents();
this.documentWorkspace.AuxiliaryLineEnabled = false;
this.documentWorkspace.Visible = false;
this.documentWorkspace.activeTool = Annotation.Enum.DrawToolType.NullTool;
this.groupBox3.Controls.Add(documentWorkspace);
//
//初始化操作按钮
//
this.commonControlButtons = new CommonControlButtons();
this.commonControlButtons.Dock = DockStyle.Top;
this.commonControlButtons.Height = 30;
this.commonControlButtons.HideZoomToWindowAndActualSize();
this.groupBox3.Controls.Add(commonControlButtons);
//
//调色板
//
this.colorsForm1 = new ColorsForm();
this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
this.colorsForm2 = new ColorsForm();
this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
this.colorsForm3 = new ColorsForm();
this.colorsForm3.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
this.colorsForm4 = new ColorsForm();
this.colorsForm4.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm4.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
this.colorsForm5 = new ColorsForm();
this.colorsForm5.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm5.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
////
////滚动条与输入框值匹配
////
//this.textBox1.Text = "" + this.trackBar1.Value;
//this.textBox2.Text = "" + this.trackBar2.Value;
}
///
/// 初始化画布按键功能
///
private void InitCommonButtonEvent()
{
this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
}
private void zoomInButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomIn();
}
private void zoomOutButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomOut();
}
private void zoomToWindowButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
}
private void actualSizeButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
}
private void pointerButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
}
private void mobileModeButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
}
///
/// 添加画布绑定事件
///
private void AddPictureBoxEvent()
{
this.documentWorkspace.panel.MouseDown += new MouseEventHandler(this.BoxMouseDownHandler);
this.documentWorkspace.panel.MouseMove += new MouseEventHandler(this.BoxMouseMoveHandler);
this.documentWorkspace.panel.MouseUp += new MouseEventHandler(this.BoxMouseUpHandler);
this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
}
///
/// 调色板回调函数
///
///
///
private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
{
}
///
/// 添加内容单元格
///
///
///
///
private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
{
DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
textboxcell.Value = text;
textboxcell.Tag = tag;
return textboxcell;
}
///
/// 设置按钮
///
///
///
private void button1_Click(object sender, EventArgs e)
{
AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.MetallographicMethod");
if (metallographicMethodSetDialog.hasModule)
{
metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
metallographicMethodSetDialog.ShowDialog();
}
else
{
metallographicMethodSetDialog = null;
}
}
///
/// 保存按钮
///
///
///
private void button2_Click(object sender, EventArgs e)
{
this.parentDialog.rectLineWidth = this.trackBar8.Value;
this.parentDialog.baseLineWidth = this.trackBar1.Value;
this.parentDialog.scopeLineWidth = this.trackBar3.Value;
this.parentDialog.orgLineWidth = this.trackBar4.Value;
this.parentDialog.rect1LineWidth = this.trackBar2.Value;
this.parentDialog.rect2LineWidth = this.trackBar5.Value;
this.parentDialog.rect3LineWidth = this.trackBar6.Value;
this.parentDialog.assistLineWidth = this.trackBar7.Value;
int res = this.parentDialog.scopeMarginLeft;
if (int.TryParse(this.textBox3.Text, out res))
this.parentDialog.scopeMarginLeft = res;
this.parentDialog.rectLineColor = this.panel2.BackColor;
this.parentDialog.baseLineColor = this.panel6.BackColor;
this.parentDialog.scopeLineColor = this.panel7.BackColor;
this.parentDialog.orgLineColor = this.panel3.BackColor;
this.parentDialog.rect1LineColor = this.panel1.BackColor;
this.parentDialog.rect2LineColor = this.panel8.BackColor;
this.parentDialog.rect3LineColor = this.panel9.BackColor;
this.parentDialog.assistLineColor = this.panel4.BackColor;
this.parentDialog.refreshWorkSpace();
this.Close();
}
/////
///// 限制只可以输入0-9数字以及退格键
/////
/////
/////
//private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
//{
// if (e.KeyChar != '\b')//这是允许输入退格键
// {
// int len = this.textBox1.Text.Length;
// if (len < 1 && e.KeyChar == '0')
// {
// e.Handled = true;
// }
// else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字
// {
// e.Handled = true;
// }
// }
//}
/////
///// 对输入值做限制
/////
/////
/////
//private void textBox1_KeyUp(object sender, KeyEventArgs e)
//{
// if (string.IsNullOrEmpty(this.textBox1.Text))
// this.textBox1.Text = "1";
// if (Convert.ToInt32(this.textBox1.Text) > 50)
// this.textBox1.Text = "50";
// this.trackBar1.Value = Convert.ToInt32(this.textBox1.Text);
////}
/////
///// 限制只可以输入0-9数字以及退格键
/////
/////
/////
//private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
//{
// if (e.KeyChar != '\b')//这是允许输入退格键
// {
// int len = this.textBox1.Text.Length;
// if (len < 1 && e.KeyChar == '0')
// {
// e.Handled = true;
// }
// else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字
// {
// e.Handled = true;
// }
// }
//}
/////
///// 对输入值做限制
/////
/////
/////
//private void textBox2_KeyUp(object sender, KeyEventArgs e)
//{
// if (string.IsNullOrEmpty(this.textBox2.Text))
// this.textBox2.Text = "1";
// if (Convert.ToInt32(this.textBox2.Text) > 50)
// this.textBox2.Text = "50";
// this.trackBar2.Value = Convert.ToInt32(this.textBox2.Text);
//}
/////
///// 基准线panel被点击
/////
/////
/////
//private void panel1_Click(object sender, EventArgs e)
//{
// this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
// this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
// this.colorsForm1.ShowDialog();
//}
//private void colorsForm1Changed(object sender, EventArgs e)
//{
// this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
// this.colorsForm1.Close();
// this.documentWorkspace.Refresh();
//}
/////
///// 线长滚动条滚动事件
/////
/////
/////
//private void trackBar1_Scroll(object sender, EventArgs e)
//{
// this.textBox1.Text = "" + this.trackBar1.Value;
//}
//private void trackBar1_ValueChanged(object sender, EventArgs e)
//{
// this.documentWorkspace.Refresh();
//}
/////
///// 线宽滚动条滚动事件
/////
/////
/////
//private void trackBar2_Scroll(object sender, EventArgs e)
//{
// this.textBox2.Text = "" + this.trackBar2.Value;
//}
//private void trackBar2_ValueChanged(object sender, EventArgs e)
//{
// this.documentWorkspace.Refresh();
//}
/////
///// 完全脱碳层选择框选中事件
/////
/////
/////
//private void checkBox2_CheckedChanged(object sender, EventArgs e)
//{
// if(this.pointList.Count > 0)
// {
// if (this.checkBox2.Checked && this.checkBox3.Checked)
// {
// foreach(PointF[] pf in pointList)
// {
// pf[2] = new PointF((pf[0].X + pf[3].X) / 2f, (pf[0].Y + pf[3].Y) / 2f);
// }
// }
// if (this.checkBox2.Checked && !this.checkBox3.Checked)
// {
// foreach (PointF[] pf in pointList)
// {
// pf[2] = new PointF((pf[0].X + pf[1].X) / 2f, (pf[0].Y + pf[1].Y) / 2f);
// }
// }
// if (!this.checkBox2.Checked)
// {
// foreach (PointF[] pf in pointList)
// {
// pf[2] = PointF.Empty;
// }
// }
// RefreshDataGridView1();
// this.documentWorkspace.Refresh();
// }
//}
/////
///// 有效脱碳层选择框选中事件
/////
/////
/////
//private void checkBox3_CheckedChanged(object sender, EventArgs e)
//{
// if (this.pointList.Count > 0)
// {
// if (this.checkBox3.Checked && this.checkBox2.Checked)
// {
// foreach (PointF[] pf in pointList)
// {
// pf[3] = new PointF((pf[2].X + pf[1].X) / 2f, (pf[2].Y + pf[1].Y) / 2f);
// }
// }
// if (this.checkBox3.Checked && !this.checkBox2.Checked)
// {
// foreach (PointF[] pf in pointList)
// {
// pf[3] = new PointF((pf[0].X + pf[1].X) / 2f, (pf[0].Y + pf[1].Y) / 2f);
// }
// }
// if (!this.checkBox3.Checked)
// {
// foreach (PointF[] pf in pointList)
// {
// pf[3] = PointF.Empty;
// }
// }
// RefreshDataGridView1();
// this.documentWorkspace.Refresh();
// }
//}
///
/// 鼠标按下
///
///
///
private void BoxMouseDownHandler(object sender, MouseEventArgs e)
{
if (operationK >= 0 && e.Button == MouseButtons.Left)
{
PointF downPoint = this.documentWorkspace.GetScalePoint(e.Location);
if (operationK == 0)
{
startPoint = endPoint = downPoint;
nowLine = new PointF[4];
nowLine[0] = startPoint;
nowLine[1] = endPoint;
pointList.Add(nowLine);
}
else if (operationK == 1)
{
lastPoint.X = downPoint.X;
lastPoint.Y = downPoint.Y;
tempPoint.X = downPoint.X;
tempPoint.Y = downPoint.Y;
for (int i = rectangleFList.Count - 1; i >= 0; i--)
{
if (rectangleFList[i].Contains(downPoint))
{
selected = i;
canMove = true;
}
}
if(selected > -1)
{
if (new RectangleF(pointList[selected][0].X - 3, pointList[selected][0].Y - 3, 7, 7).Contains(downPoint))
movePointIndex = 0;
else if (new RectangleF(pointList[selected][1].X - 3, pointList[selected][1].Y - 3, 7, 7).Contains(downPoint))
movePointIndex = 1;
else if (pointList[selected][2] != PointF.Empty && new RectangleF(pointList[selected][2].X - 3, pointList[selected][2].Y - 3, 7, 7).Contains(downPoint))
movePointIndex = 2;
else if (pointList[selected][3] != PointF.Empty && new RectangleF(pointList[selected][3].X - 3, pointList[selected][3].Y - 3, 7, 7).Contains(downPoint))
movePointIndex = 3;
else
movePointIndex = -1;
}
if (canMove)
return;
selected = -1;
}
}
}
///
/// 鼠标移动
///
///
///
private void BoxMouseMoveHandler(object sender, MouseEventArgs e)
{
this.documentWorkspace.panel.Cursor = Cursors.Default;
if (operationK >= 0 && e.Button == MouseButtons.Left)
{
PointF movePoint = this.documentWorkspace.GetScalePoint(e.Location);
//if (operationK == 0)
//{
// this.endPoint = movePoint;
// pointList[lineCount][1] = endPoint;
//}
//else if (operationK == 1 && selected > -1 && canMove)
//{
// float dx = movePoint.X - lastPoint.X;
// float dy = movePoint.Y - lastPoint.Y;
// float dxTemp = movePoint.X - tempPoint.X;
// float dyTemp = movePoint.Y - tempPoint.Y;
// lastPoint.X = movePoint.X;
// lastPoint.Y = movePoint.Y;
// if (movePointIndex == -1)
// {
// RectangleF rectangleF = new RectangleF();
// rectangleF = rectangleFList[selected];
// if (rectangleF.Contains(movePoint))
// this.documentWorkspace.panel.Cursor = Cursors.SizeAll;
// rectangleF.X += dx;
// rectangleF.Y += dy;
// rectangleFList[selected] = rectangleF;
// for (int i = 0; i < pointList[selected].Count(); i++)
// {
// pointList[selected][i].X += dx;
// pointList[selected][i].Y += dy;
// }
// }
// else if (movePointIndex == 0)
// {
// pointList[selected][0].X += dx;
// pointList[selected][0].Y += dy;
// if (checkBox2.Checked && checkBox3.Checked)
// {
// pointList[selected][2] = new PointF((2 * pointList[selected][0].X + pointList[selected][1].X) / 3f,
// (2 * pointList[selected][0].Y + pointList[selected][1].Y) / 3f);
// pointList[selected][3] = new PointF((pointList[selected][0].X + 2 * pointList[selected][1].X) / 3f,
// (pointList[selected][0].Y + 2 * pointList[selected][1].Y) / 3f);
// }
// else if (checkBox2.Checked && !checkBox3.Checked)
// {
// pointList[selected][2] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
// (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
// pointList[selected][3] = PointF.Empty;
// }
// else if (!checkBox2.Checked && checkBox3.Checked)
// {
// pointList[selected][3] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
// (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
// pointList[selected][2] = PointF.Empty;
// }
// else
// {
// pointList[selected][2] = PointF.Empty;
// pointList[selected][3] = PointF.Empty;
// }
// rectangleFList[selected] = CalcOtherRectangle(pointList[selected][0], pointList[selected][1]);
// }
// else if (movePointIndex == 1)
// {
// pointList[selected][1].X += dx;
// pointList[selected][1].Y += dy;
// if (checkBox2.Checked && checkBox3.Checked)
// {
// pointList[selected][2] = new PointF((2 * pointList[selected][0].X + pointList[selected][1].X) / 3f,
// (2 * pointList[selected][0].Y + pointList[selected][1].Y) / 3f);
// pointList[selected][3] = new PointF((pointList[selected][0].X + 2 * pointList[selected][1].X) / 3f,
// (pointList[selected][0].Y + 2 * pointList[selected][1].Y) / 3f);
// }
// else if (checkBox2.Checked && !checkBox3.Checked)
// {
// pointList[selected][2] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
// (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
// pointList[selected][3] = PointF.Empty;
// }
// else if (!checkBox2.Checked && checkBox3.Checked)
// {
// pointList[selected][3] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
// (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
// pointList[selected][2] = PointF.Empty;
// }
// else
// {
// pointList[selected][2] = PointF.Empty;
// pointList[selected][3] = PointF.Empty;
// }
// rectangleFList[selected] = CalcOtherRectangle(pointList[selected][0], pointList[selected][1]);
// }
// else if (movePointIndex == 2)
// {
// //测量线是一条垂线
// if (pointList[selected][0].X == pointList[selected][1].X)
// {
// pointList[selected][2].Y += dy;
// if (pointList[selected][3] == PointF.Empty)
// pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][2].Y);
// else
// pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][3].Y, pointList[selected][2].Y);
// }
// //测量线是一条平行线
// else if (pointList[selected][0].Y == pointList[selected][1].Y)
// {
// pointList[selected][2].X += dx;
// if (pointList[selected][3] == PointF.Empty)
// pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][2].X);
// else
// pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][3].X, pointList[selected][2].X);
// }
// //其他情况
// else
// {
// float k = (pointList[selected][1].Y - pointList[selected][0].Y) / (pointList[selected][1].X - pointList[selected][0].X);
// float b = pointList[selected][0].Y - k * pointList[selected][0].X;
// if (Math.Abs(dxTemp) >= Math.Abs(dyTemp))
// {
// pointList[selected][2].X += dx;
// if (pointList[selected][3] == PointF.Empty)
// pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][2].X);
// else
// pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][3].X, pointList[selected][2].X);
// pointList[selected][2].Y = k * pointList[selected][2].X + b;
// }
// else
// {
// pointList[selected][2].Y += dy;
// if (pointList[selected][3] == PointF.Empty)
// pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][2].Y);
// else
// pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][3].Y, pointList[selected][2].Y);
// pointList[selected][2].X = (pointList[selected][2].Y - b) / k;
// }
// }
// }
// else if (movePointIndex == 3)
// {
// //测量线是一条垂线
// if (pointList[selected][0].X == pointList[selected][1].X)
// {
// pointList[selected][3].Y += dy;
// if (pointList[selected][2] == PointF.Empty)
// pointList[selected][3].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][3].Y);
// else
// pointList[selected][3].Y = FormatCoordinate(pointList[selected][2].Y, pointList[selected][1].Y, pointList[selected][3].Y);
// }
// //测量线是一条平行线
// else if (pointList[selected][0].Y == pointList[selected][1].Y)
// {
// pointList[selected][3].X += dx;
// if (pointList[selected][2] == PointF.Empty)
// pointList[selected][3].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][3].X);
// else
// pointList[selected][3].X = FormatCoordinate(pointList[selected][2].X, pointList[selected][1].X, pointList[selected][3].X);
// }
// //其他情况
// else
// {
// float k = (pointList[selected][1].Y - pointList[selected][0].Y) / (pointList[selected][1].X - pointList[selected][0].X);
// float b = pointList[selected][0].Y - k * pointList[selected][0].X;
// if (Math.Abs(dxTemp) >= Math.Abs(dyTemp))
// {
// pointList[selected][3].X += dx;
// if (pointList[selected][2] == PointF.Empty)
// pointList[selected][3].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][3].X);
// else
// pointList[selected][3].X = FormatCoordinate(pointList[selected][2].X, pointList[selected][1].X, pointList[selected][3].X);
// pointList[selected][3].Y = k * pointList[selected][3].X + b;
// }
// else
// {
// pointList[selected][3].Y += dy;
// if (pointList[selected][2] == PointF.Empty)
// pointList[selected][3].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][3].Y);
// else
// pointList[selected][3].Y = FormatCoordinate(pointList[selected][2].Y, pointList[selected][1].Y, pointList[selected][3].Y);
// pointList[selected][3].X = (pointList[selected][3].Y - b) / k;
// }
// }
// }
//}
//this.documentWorkspace.Refresh();
}
}
///
/// 鼠标抬起
///
///
///
private void BoxMouseUpHandler(object sender, MouseEventArgs e)
{
if (operationK == 0)
{
//if (startPoint != null && endPoint != null && startPoint != endPoint)
//{
// if(checkBox2.Checked && checkBox3.Checked)
// {
// pointList[lineCount][2] = new PointF((2 * startPoint.X + endPoint.X) / 3f, (2 * startPoint.Y + endPoint.Y) / 3f);
// pointList[lineCount][3] = new PointF((startPoint.X + 2 * endPoint.X) / 3f, (startPoint.Y + 2 * endPoint.Y) / 3f);
// }
// else if (checkBox2.Checked && !checkBox3.Checked)
// {
// pointList[lineCount][2] = new PointF((startPoint.X + endPoint.X) / 2f, (startPoint.Y + endPoint.Y) / 2f);
// }
// else if (!checkBox2.Checked && checkBox3.Checked)
// {
// pointList[lineCount][3] = new PointF((startPoint.X + endPoint.X) / 2f, (startPoint.Y + endPoint.Y) / 2f);
// }
// RectangleF rectangleF = CalcOtherRectangle(pointList[lineCount][0], pointList[lineCount][1]);
// rectangleFList.Add(rectangleF);
// lineCount++;
// AddContentToDataGridView();
//}
//else
//{
// pointList.RemoveAt(pointList.Count - 1);
//}
//this.documentWorkspace.Refresh();
}
else if (operationK == 1)
{
//canMove = false;
//movePointIndex = -1;
//RefreshDataGridView1();
}
}
///
/// 绘制事件
///
///
///
private void BoxPaintHandler(object sender, PaintEventArgs e)
{
if (this.documentWorkspace.CompositionSurface != null)
{
Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
e.Graphics.TranslateTransform(x, y);
e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
Draw(e.Graphics);
e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
e.Graphics.TranslateTransform(-x, -y);
}
}
///
/// 绘制
///
private void Draw(Graphics graphics)
{
graphics.SmoothingMode = SmoothingMode.AntiAlias;
//if (tempLine != null && tempLine.Length > 0 && !bcOriginChecked())
//{
// Pen lineColor = new Pen(this.rectLineColor, this.rectLineWidth);
// for (int index = 0; index < tempLine.Length; index++)
// {
// System.Drawing.Point[] tempLine1 = tempLine[index];
// graphics.DrawLines(lineColor, tempLine1);
// }
//}
int margin = (int)(Convert.ToInt32(this.textBox3.Text) * 1200.0 / physical_width);// Math.Min(this.bitmap.Width / 2 - 5, this.bitmap.Width / 20/*(int)(this.scopeMarginLeft / this.physical_length)*/);// this.bitmap.Width / 20;
margin = (int)(margin / this.physical_length);
Line lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap.Height));
Line lineright = new Line(new System.Drawing.Point(this.bitmap.Width - margin, 0), new System.Drawing.Point(this.bitmap.Width - margin, this.bitmap.Height));
//this.parentDialog.rectLineColor = this.panel2.BackColor;
//this.parentDialog.baseLineColor = this.panel6.BackColor;
//this.parentDialog.scopeLineColor = this.panel7.BackColor;
//this.parentDialog.orgLineColor = this.panel3.BackColor;
//this.parentDialog.rect1LineColor = this.panel1.BackColor;
//this.parentDialog.rect2LineColor = this.panel8.BackColor;
//this.parentDialog.rect3LineColor = this.panel9.BackColor;
//this.parentDialog.assistLineColor = this.panel4.BackColor;
if (lineleft != null)//line
{
graphics.DrawLine(new Pen(this.panel7.BackColor, this.trackBar3.Value), lineleft.startPoint, lineleft.endPoint);
}
if (lineright != null)//line
{
graphics.DrawLine(new Pen(this.panel7.BackColor, this.trackBar3.Value), lineright.startPoint, lineright.endPoint);
}
//this.parentDialog.rectLineWidth = this.trackBar8.Value;
//this.parentDialog.baseLineWidth = this.trackBar1.Value;
//this.parentDialog.scopeLineWidth = this.trackBar3.Value;
//this.parentDialog.orgLineWidth = this.trackBar4.Value;
//this.parentDialog.rect1LineWidth = this.trackBar2.Value;
//this.parentDialog.rect2LineWidth = this.trackBar5.Value;
//this.parentDialog.rect3LineWidth = this.trackBar6.Value;
//this.parentDialog.assistLineWidth = this.trackBar7.Value;
int planesnum = 50;// planesnumcal;// int.Parse(Intent.dict["planesnum"].ToString());
int planesbottom = 50 + (int)(650/*600*/ / physical_length);// bottom.endPoint.Y;// int.Parse(Intent.dict["planesbottom"].ToString());
//if (((planesbottom - planesnum) * physical_length) < 500)
//{
// this.drawLines();
// MessageBox.Show(PdnResources.GetString("Menu.Thedistancebeselectagain.text"));
// return;
//}
Line top = new Line(new System.Drawing.Point(0, planesnum), new System.Drawing.Point(this.bitmap.Width, planesnum));
Line bottom = new Line(new System.Drawing.Point(0, planesbottom), new System.Drawing.Point(this.bitmap.Width, planesbottom));
if (top != null && bottom != null)
{
//int planesnum = top.startPoint.Y;// int.Parse(Intent.dict["planesnum"].ToString());
int planesbottom1 = planesnum + +(int)(200 / physical_length);
int planesbottom2 = planesnum + +(int)(400 / physical_length);
int planesbottom3 = bottom.startPoint.Y;// int.Parse(Intent.dict["planesbottom"].ToString());
if (((bottom.startPoint.Y - planesnum) * physical_length) > 600)
{
planesbottom3 = planesnum + +(int)(600 / physical_length);
}
graphics.DrawLine(new Pen(this.panel1.BackColor, this.trackBar2.Value), new System.Drawing.Point(0, planesbottom1), new System.Drawing.Point(this.bitmap.Width, planesbottom1));
graphics.DrawLine(new Pen(this.panel8.BackColor, this.trackBar5.Value), new System.Drawing.Point(0, planesbottom2), new System.Drawing.Point(this.bitmap.Width, planesbottom2));
if (((bottom.startPoint.Y - planesnum) * physical_length) > 600)
{
graphics.DrawLine(new Pen(this.panel9.BackColor, this.trackBar6.Value), new System.Drawing.Point(0, planesbottom3), new System.Drawing.Point(this.bitmap.Width, planesbottom3));
}
graphics.DrawLine(new Pen(this.panel3.BackColor, this.trackBar4.Value), top.startPoint, top.endPoint);
graphics.DrawLine(new Pen(this.panel6.BackColor, this.trackBar1.Value), bottom.startPoint, bottom.endPoint);
}
else if (bottom != null)
{
graphics.DrawLine(new Pen(this.panel6.BackColor, this.trackBar1.Value), bottom.startPoint, bottom.endPoint);
}
}
///
/// 计算外接矩形
///
private RectangleF CalcOtherRectangle(PointF p1, PointF p2)
{
RectangleF rectangleF = new RectangleF();
if (p1.X > p2.X)
rectangleF.X = p2.X;
else
rectangleF.X = p1.X;
if (p1.Y > p2.Y)
rectangleF.Y = p2.Y;
else
rectangleF.Y = p1.Y;
rectangleF.Width = Math.Abs(p2.X - p1.X);
rectangleF.Height = Math.Abs(p2.Y - p1.Y);
return new RectangleF(rectangleF.X - 3, rectangleF.Y - 3, rectangleF.Width + 7, rectangleF.Height + 7);
}
/////
///// 相颜色点击事件
/////
/////
/////
//private void panel6_Click(object sender, EventArgs e)
//{
// this.panelC = (Panel)sender;
// this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
// //this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
// this.colorsFormGrid.ShowDialog();
//}
///
/// PanelC的调色板颜色改变
///
///
///
private void gridColorChanged(object sender, EventArgs e)
{
Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
//更改背景色,触发事件
this.panelC.BackColor = color;
//if (this.panelC == this.panel2)
// this.parentDialog.rectLineColor = color;
//else if (this.panelC == this.panel6)
// this.parentDialog.baseLineColor = color;
//else if (this.panelC == this.panel7)
// this.parentDialog.scopeLineColor = color;
//else if (this.panelC == this.panel3)
// this.parentDialog.orgLineColor = color;
//else if (this.panelC == this.panel1)
// this.parentDialog.rect1LineColor = color;
//else if (this.panelC == this.panel8)
// this.parentDialog.rect2LineColor = color;
//else if (this.panelC == this.panel9)
// this.parentDialog.rect3LineColor = color;
//else if (this.panelC == this.panel4)
// this.parentDialog.assistLineColor = color;
//this.parentDialog.refreshWorkSpace();
this.documentWorkspace.Refresh();
//关闭色板
this.colorsFormGrid.Close();
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar1.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
///
/// 线宽输入框 对输入值做限制
///
///
private void varifyTextBoxValue(object sender)
{
if (string.IsNullOrEmpty(((TextBox)sender)/*this.textBox2*/.Text))
((TextBox)sender)/*this.textBox2*/.Text = "1";
if (Convert.ToInt32(((TextBox)sender)/*this.textBox2*/.Text) > 50)
((TextBox)sender)/*this.textBox2*/.Text = "50";
}
private void textBox5_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar3.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
private void textBox10_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar4.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
private void textBox2_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar2.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
private void textBox4_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar5.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
private void textBox6_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar6.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
private void textBox9_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar7.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
private void textBox7_KeyUp(object sender, KeyEventArgs e)
{
this.varifyTextBoxValue(sender);
this.trackBar8.Value = Convert.ToInt32(((TextBox)sender).Text);
this.documentWorkspace.Refresh();
}
private void panel6_Click(object sender, EventArgs e)
{
this.panelC = (Panel)sender;
this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(((Panel)sender).BackColor);
this.colorsFormGrid.ShowDialog();
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
this.textBox1.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
private void trackBar3_Scroll(object sender, EventArgs e)
{
this.textBox5.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
private void trackBar4_Scroll(object sender, EventArgs e)
{
this.textBox10.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
private void trackBar2_Scroll(object sender, EventArgs e)
{
this.textBox2.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
private void trackBar5_Scroll(object sender, EventArgs e)
{
this.textBox4.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
private void trackBar6_Scroll(object sender, EventArgs e)
{
this.textBox6.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
private void trackBar7_Scroll(object sender, EventArgs e)
{
this.textBox9.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
///
/// 关闭
///
///
///
private void button10_Click(object sender, EventArgs e)
{
this.Close();
}
private void textBox3_KeyUp(object sender, KeyEventArgs e)
{
if (string.IsNullOrEmpty(((TextBox)sender)/*this.textBox2*/.Text))
((TextBox)sender)/*this.textBox2*/.Text = "1";
if (this.bitmap != null)
{
int maxMargin = (int)((this.physical_width/*bitmap.Width*/ / 2 - 5) * physical_length/*physical_length11*/);// Math.Min(this.bitmap.Width / 2 - 5, this.bitmap.Width / 20/*(int)(this.scopeMarginLeft / this.physical_length)*/);// this.bitmap.Width / 20;
int margin;
if (int.TryParse(((TextBox)sender)/*this.textBox2*/.Text, out margin) && margin > maxMargin)
{
((TextBox)sender)/*this.textBox2*/.Text = maxMargin + "";
}
}
else
{
if (Convert.ToInt32(((TextBox)sender)/*this.textBox2*/.Text) > 500)
((TextBox)sender)/*this.textBox2*/.Text = "500";
}
this.documentWorkspace.Refresh();
}
private void trackBar8_Scroll(object sender, EventArgs e)
{
this.textBox7.Text = "" + ((TrackBar)sender).Value;
this.documentWorkspace.Refresh();
}
}
}