using System;
using System.Drawing;
using System.Windows.Forms;
namespace PaintDotNet.CustomControl
{
public partial class BinaryControlSmaller : UserControl
{
///
/// 画笔
///
private Pen pen = new Pen(Color.Red);
private GroupBox groupBox6;
private Button button4;
private Label label2;
private Panel panel2;
private RadioButton radioButton2;
private RadioButton radioButton1;
private GroupBox groupBox9;
private CheckBox checkBox10;
private HistogramControl histogramControl1;
private DecimalScopeControl numberScopeControl3;
private DecimalScopeControl numberScopeControl2;
private DecimalScopeControl numberScopeControl1;
private CheckBox checkBox5;
private Button button7;
private Button button6;
public double scope1Start
{
get
{
return this.numberScopeControl1.minValue;
}
set
{
this.numberScopeControl1.minValue = value;
}
}
public double scope1End
{
get
{
return this.numberScopeControl1.maxValue;
}
set
{
this.numberScopeControl1.maxValue = value;
}
}
public double scope2Start
{
get
{
return this.numberScopeControl2.minValue;
}
set
{
this.numberScopeControl2.minValue = value;
}
}
public double scope2End
{
get
{
return this.numberScopeControl2.maxValue;
}
set
{
this.numberScopeControl2.maxValue = value;
}
}
public double scope3Start
{
get
{
return this.numberScopeControl3.minValue;
}
set
{
this.numberScopeControl3.minValue = value;
}
}
public double scope3End
{
get
{
return this.numberScopeControl3.maxValue;
}
set
{
this.numberScopeControl3.maxValue = value;
}
}
///
/// 是否勾选了二值化
///
///
public bool BinaryChecked
{
get
{
return checkBox10.Checked;
}
set
{
checkBox10.Checked = value;
}
}
///
/// 是否勾选了显示原图
///
///
public bool OriginChecked
{
get
{
return checkBox5.Checked;
}
set
{
checkBox5.Checked = value;
}
}
///
/// 公开的事件,执行读取参数的事件
///
public event EventHandler BinaryGetParamAction;
private void OnBinaryGetParamAction(object sender, EventArgs e)
{
if (BinaryGetParamAction != null)
{
BinaryGetParamAction(sender, e);
}
}
///
/// 公开的事件,执行二值方法的事件
///
public event EventHandler ApplyButtonImplAction;
private void OnApplyButtonImplAction(object sender, EventArgs e)
{
if (ApplyButtonImplAction != null)
{
ApplyButtonImplAction(sender, e);
}
}
///
/// 公开的事件,筛选按钮点击的事件
///
public event EventHandler BinaryEditClickAction;
private void OnBinaryEditClickAction()
{
if (BinaryEditClickAction != null)
{
BinaryEditClickAction(this, new EventArgs());
}
}
///
/// 公开的事件,相颜色点击的事件
///
public event EventHandler PanelColorClickAction;
private void OnPanelColorClickAction()
{
if (PanelColorClickAction != null)//###20143
{
PanelColorClickAction(this, new EventArgs());
}
}
///
/// 公开的事件
///
public event EventHandler RadioButton1ChangedAction;
private void OnRadioButton1ChangedAction()
{
if (RadioButton1ChangedAction != null)
{
RadioButton1ChangedAction(this, new EventArgs());
}
}
public event EventHandler RadioButton2ChangedAction;
private void OnRadioButton2ChangedAction()
{
if (RadioButton2ChangedAction != null)
{
RadioButton2ChangedAction(this, new EventArgs());
}
}
public event EventHandler OriginCheckedChangedAction;
private void OnOriginCheckedChangedAction()
{
if (OriginCheckedChangedAction != null)
{
OriginCheckedChangedAction(this, new EventArgs());
}
}
public event EventHandler BinaryCheckedChangedAction;
private void OnBinaryCheckedChangedAction()
{
if (BinaryCheckedChangedAction != null)
{
BinaryCheckedChangedAction(this, new EventArgs());
}
}
public event EventHandler ScopeValue1ChangedAction;
private void OnScopeValue1ChangedAction(object sender, EventArgs e)
{
if (ScopeValue1ChangedAction != null)
{
ScopeValue1ChangedAction(sender, e);
}
}
public event EventHandler ScopeValue2ChangedAction;
private void OnScopeValue2ChangedAction(object sender, EventArgs e)
{
if (ScopeValue2ChangedAction != null)
{
ScopeValue2ChangedAction(sender, e);
}
}
public event EventHandler ScopeValue3ChangedAction;
private void OnScopeValue3ChangedAction(object sender, EventArgs e)
{
if (ScopeValue3ChangedAction != null)
{
ScopeValue3ChangedAction(sender, e);
}
}
///
/// 公开的事件,自动阈值按钮点击的事件
///
public event EventHandler AutoThresClickAction;
private void OnAutoThresClickAction()
{
if (AutoThresClickAction != null)
{
AutoThresClickAction(this, new EventArgs());
}
}
public Color BinaryBackColor
{
get
{
return panel2.BackColor;
}
set
{
panel2.BackColor = value;
}
}
public int BinaryStyle
{
get
{
return radioButton1.Checked ? 1 : 2;
}
set
{
if (value == 1) this.radioButton1.Checked = true;
else if (value == 2) this.radioButton2.Checked = true;
}
}
///
/// 公开的事件,反选按钮点击的事件
///
public event EventHandler InverseClickAction;
public int getInverseStyle()
{
return numberScopeControl2.Visible ? 2 : 1;
}
public void setInverseStyle(int style)
{
if (style == 1)
{
//隐藏控件
this.numberScopeControl2.Visible = false;
this.numberScopeControl3.Visible = false;
this.button6.Text = PdnResources.GetString("Menu.inverse.text");
}
else if (style == 2)
{
this.numberScopeControl2.Visible = true;
this.numberScopeControl3.Visible = true;
this.button6.Text = PdnResources.GetString("Menu.Uncheck.text");
}
}
public void OnInverseClickAction()
{
if (numberScopeControl2.Visible)
{
this.numberScopeControl1.minValue = this.numberScopeControl3.maxValue;
this.numberScopeControl1.maxValue = this.numberScopeControl2.minValue;
this.numberScopeControl2.Visible = false;
this.numberScopeControl3.Visible = false;
this.button6.Text = PdnResources.GetString("Menu.inverse.text");
this.histogramControl1.Flag = 1;
this.histogramControl1.UpdateVerticalBarWithOneScope((int)(this.numberScopeControl1.minValue), (int)(this.numberScopeControl1.maxValue));
}
else
{
this.numberScopeControl3.minValue = 0;
this.numberScopeControl3.maxValue = this.numberScopeControl1.minValue;
this.numberScopeControl2.minValue = this.numberScopeControl1.maxValue;
this.numberScopeControl2.maxValue = 255;
this.numberScopeControl2.Visible = true;
this.numberScopeControl3.Visible = true;
this.button6.Text = PdnResources.GetString("Menu.Uncheck.text");
this.histogramControl1.Flag = 2;
//处理直方图
this.histogramControl1.UpdateVerticalBarWithTwoScope(
(int)(this.numberScopeControl3.minValue),
(int)(this.numberScopeControl3.maxValue),
(int)(this.numberScopeControl2.minValue),
(int)(this.numberScopeControl2.maxValue)
);
}
if (InverseClickAction != null)
{
InverseClickAction(this, new EventArgs());
}
}
///
/// 公开的事件,第一条线拖拽的事件
///
public event EventHandler> DragOneEventActionFinish;
private void OnDragOneEventActionFinish(int start)
{
if (DragOneEventActionFinish != null)
{
DragOneEventActionFinish(this, new EventArgs(start));
}
}
public event EventHandler> DragTwoEventActionFinish;
private void OnDragTwoEventActionFinish(int end)
{
if (DragTwoEventActionFinish != null)
{
DragTwoEventActionFinish(this, new EventArgs(end));
}
}
public event EventHandler> DragThreeEventActionFinish;
private void OnDragThreeEventActionFinish(int start1)
{
if (DragThreeEventActionFinish != null)
{
DragThreeEventActionFinish(this, new EventArgs(start1));
}
}
public event EventHandler> DragFourEventActionFinish;
private void OnDragFourEventActionFinish(int start1)
{
if (DragFourEventActionFinish != null)
{
DragFourEventActionFinish(this, new EventArgs(start1));
}
}
public BinaryControlSmaller()
{
InitializeComponent();
InitializeLanguageText();
}
private void InitializeLanguageText()
{
this.button7.Text = PdnResources.GetString("Menu.Automaticthreshold.text");
this.checkBox5.Text = PdnResources.GetString("Menu.Theoriginalcolor.text");
this.checkBox10.Text = PdnResources.GetString("Menu.Binarization.text");
this.groupBox9.Text = PdnResources.GetString("Menu.Tools.Histogram.Text");
this.radioButton1.Text = PdnResources.GetString("Menu.solid.text");
this.radioButton2.Text = PdnResources.GetString("Menu.Sideline.text");
this.label2.Text = PdnResources.GetString("Menu.Phasecolor.text") + ":";
this.button4.Text = PdnResources.GetString("Menu.filter.text");
this.groupBox6.Text = PdnResources.GetString("Menu.Binarystyle.text");
this.button6.Text = PdnResources.GetString("Menu.inverse.text");
}
private void InitializeComponent()
{
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.checkBox10 = new System.Windows.Forms.CheckBox();
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.button7 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.histogramControl1 = new PaintDotNet.CustomControl.HistogramControl();
this.numberScopeControl3 = new PaintDotNet.CustomControl.DecimalScopeControl();
this.numberScopeControl2 = new PaintDotNet.CustomControl.DecimalScopeControl();
this.numberScopeControl1 = new PaintDotNet.CustomControl.DecimalScopeControl();
this.groupBox6.SuspendLayout();
this.groupBox9.SuspendLayout();
this.SuspendLayout();
//
// groupBox6
//
this.groupBox6.Controls.Add(this.button4);
this.groupBox6.Controls.Add(this.label2);
this.groupBox6.Controls.Add(this.panel2);
this.groupBox6.Controls.Add(this.radioButton2);
this.groupBox6.Controls.Add(this.radioButton1);
this.groupBox6.Location = new System.Drawing.Point(2, 205);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(356, 40);
this.groupBox6.TabIndex = 22;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "二值样式";
//
// button4
//
this.button4.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.button4.Location = new System.Drawing.Point(259, 14);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 32;
this.button4.Text = "筛选";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(131, 19);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(47, 12);
this.label2.TabIndex = 20;
this.label2.Text = "相颜色:";
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Red;
this.panel2.Location = new System.Drawing.Point(181, 14);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(72, 21);
this.panel2.TabIndex = 19;
this.panel2.Click += new System.EventHandler(this.panel2_Click);
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(58, 17);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(47, 16);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "边线";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(7, 17);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(47, 16);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "实心";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
//
// groupBox9
//
this.groupBox9.Controls.Add(this.checkBox10);
this.groupBox9.Controls.Add(this.histogramControl1);
this.groupBox9.Controls.Add(this.numberScopeControl3);
this.groupBox9.Controls.Add(this.numberScopeControl2);
this.groupBox9.Controls.Add(this.numberScopeControl1);
this.groupBox9.Controls.Add(this.checkBox5);
this.groupBox9.Controls.Add(this.button7);
this.groupBox9.Controls.Add(this.button6);
this.groupBox9.Location = new System.Drawing.Point(2, 2);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(356, 203);
this.groupBox9.TabIndex = 21;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "直方图";
//
// checkBox10
//
this.checkBox10.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.checkBox10.AutoSize = true;
this.checkBox10.Location = new System.Drawing.Point(234, 181);
this.checkBox10.Name = "checkBox10";
this.checkBox10.Size = new System.Drawing.Size(60, 16);
this.checkBox10.TabIndex = 17;
this.checkBox10.Text = "二值化";
this.checkBox10.UseVisualStyleBackColor = true;
this.checkBox10.CheckedChanged += new System.EventHandler(this.checkBox10_CheckedChanged);
//
// checkBox5
//
this.checkBox5.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.checkBox5.AutoSize = true;
this.checkBox5.Location = new System.Drawing.Point(300, 181);
this.checkBox5.Name = "checkBox5";
this.checkBox5.Size = new System.Drawing.Size(48, 16);
this.checkBox5.TabIndex = 11;
this.checkBox5.Text = "原图";
this.checkBox5.UseVisualStyleBackColor = true;
this.checkBox5.CheckedChanged += new System.EventHandler(this.ShowOrHideOriginPic);
//
// button7
//
this.button7.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.button7.Location = new System.Drawing.Point(109, 177);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(75, 23);
this.button7.TabIndex = 12;
this.button7.Text = "自动阈值";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button6
//
this.button6.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.button6.Location = new System.Drawing.Point(8, 177);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(75, 23);
this.button6.TabIndex = 11;
this.button6.Text = "反选";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// histogramControl1
//
this.histogramControl1.Flag = 1;
this.histogramControl1.Location = new System.Drawing.Point(8, 22);
this.histogramControl1.Name = "histogramControl1";
this.histogramControl1.Size = new System.Drawing.Size(340, 130);
this.histogramControl1.TabIndex = 16;
//
// numberScopeControl3
//
this.numberScopeControl3.DecimalPlaces = 0;
this.numberScopeControl3.Location = new System.Drawing.Point(8, 154);
this.numberScopeControl3.Maximum = 255D;
this.numberScopeControl3.maxValue = 0D;
this.numberScopeControl3.Minimum = 0D;
this.numberScopeControl3.minValue = 0D;
this.numberScopeControl3.Name = "numberScopeControl3";
this.numberScopeControl3.Size = new System.Drawing.Size(150, 22);
this.numberScopeControl3.TabIndex = 15;
this.numberScopeControl3.Visible = false;
this.numberScopeControl3.ValueChanged += new System.EventHandler(this.OnScopeValue3ChangedAction);
//
// numberScopeControl2
//
this.numberScopeControl2.DecimalPlaces = 0;
this.numberScopeControl2.Location = new System.Drawing.Point(186, 154);
this.numberScopeControl2.Maximum = 255D;
this.numberScopeControl2.maxValue = 0D;
this.numberScopeControl2.Minimum = 0D;
this.numberScopeControl2.minValue = 0D;
this.numberScopeControl2.Name = "numberScopeControl2";
this.numberScopeControl2.Size = new System.Drawing.Size(150, 22);
this.numberScopeControl2.TabIndex = 14;
this.numberScopeControl2.Visible = false;
this.numberScopeControl2.ValueChanged += new System.EventHandler(this.OnScopeValue2ChangedAction);
//
// numberScopeControl1
//
this.numberScopeControl1.DecimalPlaces = 0;
this.numberScopeControl1.Location = new System.Drawing.Point(8, 154);
this.numberScopeControl1.Maximum = 255D;
this.numberScopeControl1.maxValue = 0D;
this.numberScopeControl1.Minimum = 0D;
this.numberScopeControl1.minValue = 0D;
this.numberScopeControl1.Name = "numberScopeControl1";
this.numberScopeControl1.Size = new System.Drawing.Size(150, 22);
this.numberScopeControl1.TabIndex = 13;
this.numberScopeControl1.Tag = "numberScopeControl1";
this.numberScopeControl1.ValueChanged += new System.EventHandler(this.OnScopeValue1ChangedAction);
//
// BinaryControlSmaller
//
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox9);
this.Name = "BinaryControlSmaller";
this.Size = new System.Drawing.Size(360, 247);
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.ResumeLayout(false);
}
///
/// 筛选按钮
///
///
///
private void button4_Click(object sender, EventArgs e)
{
OnBinaryEditClickAction();
}
///
/// 相颜色点击事件
///
///
///
private void panel2_Click(object sender, EventArgs e)
{
OnPanelColorClickAction();
}
///
/// 二值样式 边线选中事件
///
///
///
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
OnRadioButton2ChangedAction();
}
///
/// 二值样式 实心选中事件
///
///
///
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
OnRadioButton1ChangedAction();
}
private void ShowOrHideOriginPic(object sender, EventArgs e)
{
OnOriginCheckedChangedAction();
}
private void checkBox10_CheckedChanged(object sender, EventArgs e)
{
OnBinaryCheckedChangedAction();
}
private void button7_Click(object sender, EventArgs e)
{
OnAutoThresClickAction();
}
private void button6_Click(object sender, EventArgs e)
{
OnInverseClickAction();
}
///
/// 把参数的值设置到控件上
///
public void InitParameterToControl(int ColorInterval = -1)
{
if (ColorInterval != -1 ? ColorInterval == 1 : this.getInverseStyle() == 1)
{
//处理直方图
this.histogramControl1.UpdateVerticalBarWithOneScope((int)(this.numberScopeControl1.minValue), (int)(this.numberScopeControl1.maxValue));
}
else
{
//处理直方图
this.histogramControl1.UpdateVerticalBarWithTwoScope(
(int)(this.numberScopeControl3.minValue),
(int)(this.numberScopeControl3.maxValue),
(int)(this.numberScopeControl2.minValue),
(int)(this.numberScopeControl2.maxValue)
);
}
}
///
/// 颜色区间2 截止值变化
///
///
///
private void DragFourEvent(object sender, EventArgs e)
{
this.numberScopeControl2.maxValue = e.Data;
}
///
/// 颜色区间2 起始值变化
///
///
///
private void DragThreeEvent(object sender, EventArgs e)
{
this.numberScopeControl2.minValue = e.Data;
}
///
/// 颜色区间1 截止值变化
///
///
///
private void DragTwoEvent(object sender, EventArgs e)
{
if (this.getInverseStyle() == 1)
{
this.numberScopeControl1.maxValue = e.Data;
}
else if (this.getInverseStyle() == 2)
{
this.numberScopeControl3.maxValue = e.Data;
}
}
///
/// 颜色区间1 起始值变化
///
///
///
private void DragOneEvent(object sender, EventArgs e)
{
if (this.getInverseStyle() == 1)
{
this.numberScopeControl1.minValue = e.Data;
}
else if (this.getInverseStyle() == 2)
{
this.numberScopeControl3.minValue = e.Data;
}
}
private void DragFiveEvent(object sender, EventArgs e)
{
DeleteEventHandler();
if (this.getInverseStyle() == 1)
{
this.numberScopeControl1.minValue = e.Data[1];
this.numberScopeControl1.maxValue = e.Data[0];
}
else if (this.getInverseStyle() == 2)
{
this.numberScopeControl3.minValue = e.Data[1];
this.numberScopeControl3.maxValue = e.Data[0];
}
AddEventHandler();
this.OnApplyButtonImplAction(null, null);
}
private void DragSixEvent(object sender, EventArgs e)
{
DeleteEventHandler();
this.numberScopeControl2.minValue = e.Data[1];
this.numberScopeControl2.maxValue = e.Data[0];
AddEventHandler();
this.OnApplyButtonImplAction(null, null);
}
public void InitBinaryControlEvent()//InitHistogramDragEvent()
{
this.histogramControl1.DragOneEventActionFinish += new EventHandler>(this.DragOneEvent);
this.histogramControl1.DragTwoEventActionFinish += new EventHandler>(this.DragTwoEvent);
this.histogramControl1.DragThreeEventActionFinish += new EventHandler>(this.DragThreeEvent);
this.histogramControl1.DragFourEventActionFinish += new EventHandler>(this.DragFourEvent);
this.histogramControl1.DragFiveEventActionFinish += new EventHandler>(this.DragFiveEvent);
this.histogramControl1.DragSixEventActionFinish += new EventHandler>(this.DragSixEvent);
}
public void AddEventHandler()
{
this.numberScopeControl1.ValueChanged += this.numberScope1_ValueChanged;
this.numberScopeControl1.numericUpDown1.KeyUp += this.numberScope1_ValueChanged;
this.numberScopeControl1.numericUpDown2.KeyUp += this.numberScope1_ValueChanged;
this.numberScopeControl3.numericUpDown2.KeyUp += this.OnApplyButtonImplAction;//###
this.numberScopeControl2.ValueChanged += this.numberScope2_ValueChanged;
this.numberScopeControl2.numericUpDown1.KeyUp += this.numberScope2_ValueChanged;
this.numberScopeControl2.numericUpDown2.KeyUp += this.numberScope2_ValueChanged;
this.numberScopeControl3.ValueChanged += this.numberScope3_ValueChanged;
this.numberScopeControl3.numericUpDown1.KeyUp += this.numberScope3_ValueChanged;
this.numberScopeControl3.numericUpDown2.KeyUp += this.numberScope3_ValueChanged;
this.numberScopeControl1.ValueChanged += this.OnApplyButtonImplAction;
this.numberScopeControl2.ValueChanged += this.OnApplyButtonImplAction;
this.numberScopeControl3.ValueChanged += this.OnApplyButtonImplAction;
//this.panel2.BackColorChanged += this.OnApplyButtonImplAction;
this.radioButton1.CheckedChanged += this.OnApplyButtonImplAction;
this.radioButton2.CheckedChanged += this.OnApplyButtonImplAction;
}
public void DeleteEventHandler()
{
this.numberScopeControl1.ValueChanged -= this.numberScope1_ValueChanged;
this.numberScopeControl1.numericUpDown1.KeyUp -= this.numberScope1_ValueChanged;
this.numberScopeControl1.numericUpDown2.KeyUp -= this.numberScope1_ValueChanged;
this.numberScopeControl3.numericUpDown2.KeyUp -= this.OnApplyButtonImplAction;//###
this.numberScopeControl2.ValueChanged -= this.numberScope2_ValueChanged;
this.numberScopeControl2.numericUpDown1.KeyUp -= this.numberScope2_ValueChanged;
this.numberScopeControl2.numericUpDown2.KeyUp -= this.numberScope2_ValueChanged;
this.numberScopeControl3.ValueChanged -= this.numberScope3_ValueChanged;
this.numberScopeControl3.numericUpDown1.KeyUp -= this.numberScope3_ValueChanged;
this.numberScopeControl3.numericUpDown2.KeyUp -= this.numberScope3_ValueChanged;
this.numberScopeControl1.ValueChanged -= this.OnApplyButtonImplAction;
this.numberScopeControl2.ValueChanged -= this.OnApplyButtonImplAction;
this.numberScopeControl3.ValueChanged -= this.OnApplyButtonImplAction;
//this.panel2.BackColorChanged -= this.OnApplyButtonImplAction;
this.radioButton1.CheckedChanged -= this.OnApplyButtonImplAction;
this.radioButton2.CheckedChanged -= this.OnApplyButtonImplAction;
}
//处理直方图
public void UpdateVerticalBarWithOneScope(int start, int end)
{
this.histogramControl1.UpdateVerticalBarWithOneScope(start, end);
}
//绘制直方图
public void CreateHistogram(OpenCvSharp.Mat imageMat, bool isGray, int width, int height, int channel)
{
this.histogramControl1.CreateHistogram(imageMat, isGray, width, height, channel);
}
///
/// 一个颜色区间时
/// 区间值变化的事件
///
///
///
private void numberScope1_ValueChanged(object sender, EventArgs e)
{
this.OnBinaryGetParamAction(sender, e);
//处理直方图
this.histogramControl1.UpdateVerticalBarWithOneScope((int)(this.numberScopeControl1.minValue), (int)(this.numberScopeControl1.maxValue));
}
///
/// 二个颜色区间时
/// 区间1值变化的事件
///
///
///
private void numberScope2_ValueChanged(object sender, EventArgs e)
{
this.OnBinaryGetParamAction(sender, e);
//处理直方图
this.histogramControl1.UpdateVerticalBarWithTwoScope(
(int)(this.numberScopeControl3.minValue),
(int)(this.numberScopeControl3.maxValue),
(int)(this.numberScopeControl2.minValue),
(int)(this.numberScopeControl2.maxValue)
);
}
///
/// 二个颜色区间时
/// 区间2值变化的事件
///
///
///
private void numberScope3_ValueChanged(object sender, EventArgs e)
{
this.OnBinaryGetParamAction(sender, e);
//处理直方图
this.histogramControl1.UpdateVerticalBarWithTwoScope(
(int)(this.numberScopeControl3.minValue),
(int)(this.numberScopeControl3.maxValue),
(int)(this.numberScopeControl2.minValue),
(int)(this.numberScopeControl2.maxValue)
);
}
}
}