Commit 484b1f32 LN

界面修改

1 个父辈 3324a83b
......@@ -15,7 +15,7 @@ namespace AccAOI
public partial class FrmAoiSetting : Asa.Theme.FlatForm
{
private control.ABaseControl aoiControl = null;
private Image Img = null;
public Image Img = null;
private AoiProject Project = null;
public FrmAoiSetting()
{
......
......@@ -30,61 +30,61 @@ namespace AccAOI.control
/// </summary>
private void InitializeComponent()
{
this.panControl = new Asa.Theme.FlatPanel();
this.panAreaImage = new Asa.Theme.FlatPanel();
this.panAreaSet = new Asa.Theme.FlatPanel();
this.panParam = new Asa.Theme.FlatPanel();
this.panResult = new Asa.Theme.FlatPanel();
this.btnClearArea = new Asa.Theme.FlatButton();
this.btnSetArea = new Asa.Theme.FlatButton();
this.aoiImage = new Cyotek.Windows.Forms.ImageBox();
this.btnYuan = new Asa.Theme.FlatButton();
this.aoiImage = new ImageBox();
this.btnSetArea = new Asa.Theme.FlatButton();
this.btnClearArea = new Asa.Theme.FlatButton();
this.panResult = new Asa.Theme.FlatPanel();
this.panParam = new Asa.Theme.FlatPanel();
this.panAreaSet = new Asa.Theme.FlatPanel();
this.panAreaImage = new Asa.Theme.FlatPanel();
this.panControl = new Asa.Theme.FlatPanel();
this.SuspendLayout();
//
// panControl
// aoiImage
//
this.panControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.aoiImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panControl.Inside = false;
this.panControl.Location = new System.Drawing.Point(0, 0);
this.panControl.Name = "panControl";
this.panControl.Size = new System.Drawing.Size(308, 696);
this.panControl.TabIndex = 0;
this.panControl.Text = "斑点分析";
this.aoiImage.Location = new System.Drawing.Point(9, 53);
this.aoiImage.Name = "aoiImage";
this.aoiImage.Size = new System.Drawing.Size(288, 182);
this.aoiImage.TabIndex = 2;
//
// panAreaImage
// btnYuan
//
this.panAreaImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panAreaImage.Inside = false;
this.panAreaImage.Location = new System.Drawing.Point(4, 27);
this.panAreaImage.Name = "panAreaImage";
this.panAreaImage.Size = new System.Drawing.Size(298, 212);
this.panAreaImage.TabIndex = 1;
this.panAreaImage.Text = "区域图片";
this.btnYuan.ImageSize = new System.Drawing.Size(0, 0);
this.btnYuan.Inside = false;
this.btnYuan.Location = new System.Drawing.Point(108, 274);
this.btnYuan.Name = "btnYuan";
this.btnYuan.Size = new System.Drawing.Size(90, 30);
this.btnYuan.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnYuan.TabIndex = 8;
this.btnYuan.Text = "椭圆";
this.btnYuan.Click += new System.EventHandler(this.btnYuan_Click);
//
// panAreaSet
// btnSetArea
//
this.panAreaSet.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panAreaSet.Inside = false;
this.panAreaSet.Location = new System.Drawing.Point(4, 244);
this.panAreaSet.Name = "panAreaSet";
this.panAreaSet.Size = new System.Drawing.Size(298, 69);
this.panAreaSet.TabIndex = 3;
this.panAreaSet.Text = "区域设置-矩形";
this.btnSetArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnSetArea.Inside = false;
this.btnSetArea.Location = new System.Drawing.Point(12, 274);
this.btnSetArea.Name = "btnSetArea";
this.btnSetArea.Size = new System.Drawing.Size(90, 30);
this.btnSetArea.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnSetArea.TabIndex = 7;
this.btnSetArea.Text = "矩形";
this.btnSetArea.Click += new System.EventHandler(this.btnSetArea_Click);
//
// panParam
// btnClearArea
//
this.panParam.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panParam.Inside = false;
this.panParam.Location = new System.Drawing.Point(4, 319);
this.panParam.Name = "panParam";
this.panParam.Size = new System.Drawing.Size(298, 167);
this.panParam.TabIndex = 4;
this.panParam.Text = "参数设置";
this.btnClearArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnClearArea.Inside = false;
this.btnClearArea.Location = new System.Drawing.Point(204, 274);
this.btnClearArea.Name = "btnClearArea";
this.btnClearArea.Size = new System.Drawing.Size(90, 30);
this.btnClearArea.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnClearArea.TabIndex = 6;
this.btnClearArea.Text = "清除";
this.btnClearArea.Click += new System.EventHandler(this.btnClearArea_Click);
//
// panResult
//
......@@ -94,55 +94,59 @@ namespace AccAOI.control
this.panResult.Inside = false;
this.panResult.Location = new System.Drawing.Point(4, 491);
this.panResult.Name = "panResult";
this.panResult.Padding = new System.Windows.Forms.Padding(6, 30, 6, 6);
this.panResult.Size = new System.Drawing.Size(298, 197);
this.panResult.TabIndex = 5;
this.panResult.Text = "结果判断";
//
// btnClearArea
// panParam
//
this.btnClearArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnClearArea.Inside = false;
this.btnClearArea.Location = new System.Drawing.Point(204, 274);
this.btnClearArea.Name = "btnClearArea";
this.btnClearArea.Size = new System.Drawing.Size(90, 30);
this.btnClearArea.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnClearArea.TabIndex = 6;
this.btnClearArea.Text = "清除";
this.btnClearArea.Click += new System.EventHandler(this.btnClearArea_Click);
this.panParam.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panParam.Inside = false;
this.panParam.Location = new System.Drawing.Point(4, 319);
this.panParam.Name = "panParam";
this.panParam.Padding = new System.Windows.Forms.Padding(6, 30, 6, 6);
this.panParam.Size = new System.Drawing.Size(298, 167);
this.panParam.TabIndex = 4;
this.panParam.Text = "参数设置";
//
// btnSetArea
// panAreaSet
//
this.btnSetArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnSetArea.Inside = false;
this.btnSetArea.Location = new System.Drawing.Point(12, 274);
this.btnSetArea.Name = "btnSetArea";
this.btnSetArea.Size = new System.Drawing.Size(90, 30);
this.btnSetArea.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnSetArea.TabIndex = 7;
this.btnSetArea.Text = "矩形";
this.btnSetArea.Click += new System.EventHandler(this.btnSetArea_Click);
this.panAreaSet.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panAreaSet.Inside = false;
this.panAreaSet.Location = new System.Drawing.Point(4, 244);
this.panAreaSet.Name = "panAreaSet";
this.panAreaSet.Padding = new System.Windows.Forms.Padding(6, 30, 6, 6);
this.panAreaSet.Size = new System.Drawing.Size(298, 69);
this.panAreaSet.TabIndex = 3;
this.panAreaSet.Text = "区域设置-矩形";
//
// btnYuan
// panAreaImage
//
this.btnYuan.ImageSize = new System.Drawing.Size(0, 0);
this.btnYuan.Inside = false;
this.btnYuan.Location = new System.Drawing.Point(108, 274);
this.btnYuan.Name = "btnYuan";
this.btnYuan.Size = new System.Drawing.Size(90, 30);
this.btnYuan.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnYuan.TabIndex = 8;
this.btnYuan.Text = "椭圆";
this.btnYuan.Click += new System.EventHandler(this.btnYuan_Click);
this.panAreaImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panAreaImage.Inside = false;
this.panAreaImage.Location = new System.Drawing.Point(4, 27);
this.panAreaImage.Name = "panAreaImage";
this.panAreaImage.Padding = new System.Windows.Forms.Padding(6, 30, 6, 6);
this.panAreaImage.Size = new System.Drawing.Size(298, 212);
this.panAreaImage.TabIndex = 1;
this.panAreaImage.Text = "区域图片";
//
// aoiImage
// panControl
//
this.aoiImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.panControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//this.aoiImage.DragHandleSize = 9;
this.aoiImage.Location = new System.Drawing.Point(9, 53);
this.aoiImage.Name = "aoiImage";
this.aoiImage.Size = new System.Drawing.Size(288, 182);
this.aoiImage.TabIndex = 2;
this.panControl.Inside = false;
this.panControl.Location = new System.Drawing.Point(0, 0);
this.panControl.Name = "panControl";
this.panControl.Padding = new System.Windows.Forms.Padding(6, 30, 6, 6);
this.panControl.Size = new System.Drawing.Size(308, 696);
this.panControl.TabIndex = 0;
this.panControl.Text = "斑点分析";
//
// ABaseControl
//
......@@ -170,10 +174,10 @@ namespace AccAOI.control
private Asa.Theme.FlatPanel panAreaSet;
private Asa.Theme.FlatButton btnClearArea;
private Asa.Theme.FlatButton btnSetArea;
private Asa.Theme.FlatPanel panControl;
protected Asa.Theme.FlatPanel panParam;
protected Asa.Theme.FlatPanel panResult;
public ImageBox aoiImage;
private Asa.Theme.FlatButton btnYuan;
public Asa.Theme.FlatPanel panControl;
}
}
......@@ -24,6 +24,15 @@ namespace AccAOI.control
get { return panControl.Text; }
set { panControl.Text = value; }
}
public Image GetImg()
{
if (this.Parent != null && this.Parent is FrmAoiSetting)
{
return ((FrmAoiSetting)this.Parent).Img;
}
return null;
}
/// <summary>
/// 区域类型,1=矩形,2=圆形
/// </summary>
......@@ -32,14 +41,23 @@ namespace AccAOI.control
/// 区域信息
/// </summary>
public GraphicsPath currPath = null;
public ImageBox BImageBox;
public AoiMethod AoiInfo;
/// <summary>
/// 未处理的小图
/// </summary>
protected Image BaseImage = null;
public void SetImage(Image image)
public void SetCurrPath(GraphicsPath path)
{
this.aoiImage.Image = image;
BaseImage = image;
this.currPath = path;
UpdateImage();
}
public virtual void UpdateImage()
{
}
public virtual void ShowAoiInfo()
{
......
......@@ -101,15 +101,16 @@
// chkwhiteOnBlack
//
this.chkwhiteOnBlack.Inside = false;
this.chkwhiteOnBlack.Location = new System.Drawing.Point(151, 405);
this.chkwhiteOnBlack.Location = new System.Drawing.Point(125, 419);
this.chkwhiteOnBlack.Name = "chkwhiteOnBlack";
this.chkwhiteOnBlack.Size = new System.Drawing.Size(62, 30);
this.chkwhiteOnBlack.TabIndex = 15;
this.chkwhiteOnBlack.CheckedChanged += new Asa.Theme.Event.ValueChanged(this.chkwhiteOnBlack_CheckedChanged);
//
// flatLabel2
//
this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(14, 405);
this.flatLabel2.Location = new System.Drawing.Point(12, 419);
this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(75, 30);
this.flatLabel2.TabIndex = 16;
......
......@@ -23,6 +23,7 @@ namespace AccAOI.control
{
int value = trackBarThresh.Value;
lblthresh.Text = value.ToString();
UpdateImage();
}
private AoiBlobMethod MethodBlob = null;
public override void ShowAoiInfo()
......@@ -74,8 +75,12 @@ namespace AccAOI.control
}
return AoiInfo;
}
private void UpdateImage()
public override void UpdateImage()
{
if (BaseImage == null)
{
return;
}
GetAoiInfo();
Image outImage = null;
List<CvBlob> list = new List<CvBlob>();
......@@ -89,5 +94,10 @@ namespace AccAOI.control
{
UpdateImage();
}
private void chkwhiteOnBlack_CheckedChanged(object sender)
{
UpdateImage();
}
}
}
......@@ -47,20 +47,56 @@
this.txtRate = new Asa.Theme.FlatText();
this.flatLabel9 = new Asa.Theme.FlatLabel();
this.btnUpdate = new Asa.Theme.FlatButton();
this.tbMinR = new System.Windows.Forms.TrackBar();
this.tbMaxR = new System.Windows.Forms.TrackBar();
this.tbMaxG = new System.Windows.Forms.TrackBar();
this.tbMinG = new System.Windows.Forms.TrackBar();
this.tbMaxB = new System.Windows.Forms.TrackBar();
this.tbMinB = new System.Windows.Forms.TrackBar();
this.panParam.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tbMinR)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tbMaxR)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tbMaxG)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tbMinG)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tbMaxB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tbMinB)).BeginInit();
this.SuspendLayout();
//
// panParam
//
this.panParam.Size = new System.Drawing.Size(298, 166);
this.panParam.Controls.Add(this.tbMaxB);
this.panParam.Controls.Add(this.tbMinB);
this.panParam.Controls.Add(this.tbMaxG);
this.panParam.Controls.Add(this.tbMinG);
this.panParam.Controls.Add(this.tbMaxR);
this.panParam.Controls.Add(this.tbMinR);
this.panParam.Controls.Add(this.txtMinR);
this.panParam.Controls.Add(this.txtMaxB);
this.panParam.Controls.Add(this.flatLabel7);
this.panParam.Controls.Add(this.flatLabel1);
this.panParam.Controls.Add(this.txtMaxR);
this.panParam.Controls.Add(this.txtMinB);
this.panParam.Controls.Add(this.flatLabel6);
this.panParam.Controls.Add(this.txtMaxG);
this.panParam.Controls.Add(this.flatLabel4);
this.panParam.Controls.Add(this.flatLabel8);
this.panParam.Controls.Add(this.txtMinG);
this.panParam.Size = new System.Drawing.Size(298, 363);
//
// panResult
//
this.panResult.Size = new System.Drawing.Size(298, 189);
this.panResult.Location = new System.Drawing.Point(4, 688);
this.panResult.Size = new System.Drawing.Size(298, 131);
//
// panControl
//
this.panControl.Size = new System.Drawing.Size(308, 826);
this.panControl.Text = "颜色抽取";
//
// flatLabel5
//
this.flatLabel5.Inside = false;
this.flatLabel5.Location = new System.Drawing.Point(181, 533);
this.flatLabel5.Location = new System.Drawing.Point(181, 730);
this.flatLabel5.Name = "flatLabel5";
this.flatLabel5.Size = new System.Drawing.Size(24, 25);
this.flatLabel5.TabIndex = 23;
......@@ -70,7 +106,7 @@
//
this.txtmaxRate.Font = new System.Drawing.Font("宋体", 9F);
this.txtmaxRate.Inside = false;
this.txtmaxRate.Location = new System.Drawing.Point(210, 527);
this.txtmaxRate.Location = new System.Drawing.Point(210, 724);
this.txtmaxRate.Name = "txtmaxRate";
this.txtmaxRate.Padding = new System.Windows.Forms.Padding(3);
this.txtmaxRate.Size = new System.Drawing.Size(74, 30);
......@@ -80,7 +116,7 @@
//
this.txtminRate.Font = new System.Drawing.Font("宋体", 9F);
this.txtminRate.Inside = false;
this.txtminRate.Location = new System.Drawing.Point(103, 527);
this.txtminRate.Location = new System.Drawing.Point(103, 724);
this.txtminRate.Name = "txtminRate";
this.txtminRate.Padding = new System.Windows.Forms.Padding(3);
this.txtminRate.Size = new System.Drawing.Size(74, 30);
......@@ -89,7 +125,7 @@
// flatLabel3
//
this.flatLabel3.Inside = false;
this.flatLabel3.Location = new System.Drawing.Point(19, 527);
this.flatLabel3.Location = new System.Drawing.Point(19, 724);
this.flatLabel3.Name = "flatLabel3";
this.flatLabel3.Size = new System.Drawing.Size(75, 30);
this.flatLabel3.TabIndex = 20;
......@@ -98,17 +134,17 @@
// flatLabel1
//
this.flatLabel1.Inside = false;
this.flatLabel1.Location = new System.Drawing.Point(181, 358);
this.flatLabel1.Location = new System.Drawing.Point(15, 93);
this.flatLabel1.Name = "flatLabel1";
this.flatLabel1.Size = new System.Drawing.Size(24, 25);
this.flatLabel1.Size = new System.Drawing.Size(35, 30);
this.flatLabel1.TabIndex = 27;
this.flatLabel1.Text = "~";
this.flatLabel1.Text = "MaxR:";
//
// txtMaxR
//
this.txtMaxR.Font = new System.Drawing.Font("宋体", 9F);
this.txtMaxR.Inside = false;
this.txtMaxR.Location = new System.Drawing.Point(210, 352);
this.txtMaxR.Location = new System.Drawing.Point(62, 93);
this.txtMaxR.Name = "txtMaxR";
this.txtMaxR.Padding = new System.Windows.Forms.Padding(3);
this.txtMaxR.Size = new System.Drawing.Size(74, 30);
......@@ -119,7 +155,7 @@
//
this.txtMinR.Font = new System.Drawing.Font("宋体", 9F);
this.txtMinR.Inside = false;
this.txtMinR.Location = new System.Drawing.Point(103, 352);
this.txtMinR.Location = new System.Drawing.Point(62, 41);
this.txtMinR.Name = "txtMinR";
this.txtMinR.Padding = new System.Windows.Forms.Padding(3);
this.txtMinR.Size = new System.Drawing.Size(74, 30);
......@@ -129,26 +165,26 @@
// flatLabel2
//
this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(19, 352);
this.flatLabel2.Location = new System.Drawing.Point(19, 358);
this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(75, 30);
this.flatLabel2.Size = new System.Drawing.Size(35, 30);
this.flatLabel2.TabIndex = 24;
this.flatLabel2.Text = "R:";
this.flatLabel2.Text = "MinR:";
//
// flatLabel4
//
this.flatLabel4.Inside = false;
this.flatLabel4.Location = new System.Drawing.Point(181, 404);
this.flatLabel4.Location = new System.Drawing.Point(15, 197);
this.flatLabel4.Name = "flatLabel4";
this.flatLabel4.Size = new System.Drawing.Size(24, 25);
this.flatLabel4.Size = new System.Drawing.Size(35, 30);
this.flatLabel4.TabIndex = 31;
this.flatLabel4.Text = "~";
this.flatLabel4.Text = "MaxG:";
//
// txtMaxG
//
this.txtMaxG.Font = new System.Drawing.Font("宋体", 9F);
this.txtMaxG.Inside = false;
this.txtMaxG.Location = new System.Drawing.Point(210, 398);
this.txtMaxG.Location = new System.Drawing.Point(62, 197);
this.txtMaxG.Name = "txtMaxG";
this.txtMaxG.Padding = new System.Windows.Forms.Padding(3);
this.txtMaxG.Size = new System.Drawing.Size(74, 30);
......@@ -159,7 +195,7 @@
//
this.txtMinG.Font = new System.Drawing.Font("宋体", 9F);
this.txtMinG.Inside = false;
this.txtMinG.Location = new System.Drawing.Point(103, 398);
this.txtMinG.Location = new System.Drawing.Point(62, 145);
this.txtMinG.Name = "txtMinG";
this.txtMinG.Padding = new System.Windows.Forms.Padding(3);
this.txtMinG.Size = new System.Drawing.Size(74, 30);
......@@ -168,27 +204,28 @@
//
// flatLabel6
//
this.flatLabel6.Cursor = System.Windows.Forms.Cursors.Default;
this.flatLabel6.Inside = false;
this.flatLabel6.Location = new System.Drawing.Point(19, 398);
this.flatLabel6.Location = new System.Drawing.Point(15, 145);
this.flatLabel6.Name = "flatLabel6";
this.flatLabel6.Size = new System.Drawing.Size(75, 30);
this.flatLabel6.Size = new System.Drawing.Size(35, 30);
this.flatLabel6.TabIndex = 28;
this.flatLabel6.Text = "G:";
this.flatLabel6.Text = "MinG:";
//
// flatLabel7
//
this.flatLabel7.Inside = false;
this.flatLabel7.Location = new System.Drawing.Point(181, 450);
this.flatLabel7.Location = new System.Drawing.Point(15, 301);
this.flatLabel7.Name = "flatLabel7";
this.flatLabel7.Size = new System.Drawing.Size(24, 25);
this.flatLabel7.Size = new System.Drawing.Size(35, 30);
this.flatLabel7.TabIndex = 35;
this.flatLabel7.Text = "~";
this.flatLabel7.Text = "MaxB:";
//
// txtMaxB
//
this.txtMaxB.Font = new System.Drawing.Font("宋体", 9F);
this.txtMaxB.Inside = false;
this.txtMaxB.Location = new System.Drawing.Point(210, 444);
this.txtMaxB.Location = new System.Drawing.Point(62, 301);
this.txtMaxB.Name = "txtMaxB";
this.txtMaxB.Padding = new System.Windows.Forms.Padding(3);
this.txtMaxB.Size = new System.Drawing.Size(74, 30);
......@@ -199,7 +236,7 @@
//
this.txtMinB.Font = new System.Drawing.Font("宋体", 9F);
this.txtMinB.Inside = false;
this.txtMinB.Location = new System.Drawing.Point(103, 444);
this.txtMinB.Location = new System.Drawing.Point(62, 249);
this.txtMinB.Name = "txtMinB";
this.txtMinB.Padding = new System.Windows.Forms.Padding(3);
this.txtMinB.Size = new System.Drawing.Size(74, 30);
......@@ -209,18 +246,18 @@
// flatLabel8
//
this.flatLabel8.Inside = false;
this.flatLabel8.Location = new System.Drawing.Point(19, 444);
this.flatLabel8.Location = new System.Drawing.Point(15, 249);
this.flatLabel8.Name = "flatLabel8";
this.flatLabel8.Size = new System.Drawing.Size(75, 30);
this.flatLabel8.Size = new System.Drawing.Size(35, 30);
this.flatLabel8.TabIndex = 32;
this.flatLabel8.Text = "B:";
this.flatLabel8.Text = "MinB:";
//
// txtRate
//
this.txtRate.Enabled = false;
this.txtRate.Font = new System.Drawing.Font("宋体", 9F);
this.txtRate.Inside = false;
this.txtRate.Location = new System.Drawing.Point(108, 577);
this.txtRate.Location = new System.Drawing.Point(108, 774);
this.txtRate.Name = "txtRate";
this.txtRate.Padding = new System.Windows.Forms.Padding(3);
this.txtRate.Size = new System.Drawing.Size(74, 30);
......@@ -229,7 +266,7 @@
// flatLabel9
//
this.flatLabel9.Inside = false;
this.flatLabel9.Location = new System.Drawing.Point(19, 577);
this.flatLabel9.Location = new System.Drawing.Point(19, 774);
this.flatLabel9.Name = "flatLabel9";
this.flatLabel9.Size = new System.Drawing.Size(83, 30);
this.flatLabel9.TabIndex = 37;
......@@ -239,7 +276,7 @@
//
this.btnUpdate.ImageSize = new System.Drawing.Size(0, 0);
this.btnUpdate.Inside = false;
this.btnUpdate.Location = new System.Drawing.Point(204, 577);
this.btnUpdate.Location = new System.Drawing.Point(204, 774);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(90, 30);
this.btnUpdate.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
......@@ -247,25 +284,83 @@
this.btnUpdate.Text = "更新";
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
//
// tbMinR
//
this.tbMinR.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.tbMinR.Location = new System.Drawing.Point(145, 41);
this.tbMinR.Maximum = 255;
this.tbMinR.Name = "tbMinR";
this.tbMinR.Size = new System.Drawing.Size(141, 45);
this.tbMinR.TabIndex = 10;
this.tbMinR.TickStyle = System.Windows.Forms.TickStyle.None;
this.tbMinR.ValueChanged += new System.EventHandler(this.tbMinR_ValueChanged);
//
// tbMaxR
//
this.tbMaxR.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.tbMaxR.Location = new System.Drawing.Point(145, 94);
this.tbMaxR.Maximum = 255;
this.tbMaxR.Name = "tbMaxR";
this.tbMaxR.Size = new System.Drawing.Size(141, 45);
this.tbMaxR.TabIndex = 28;
this.tbMaxR.TickStyle = System.Windows.Forms.TickStyle.None;
this.tbMaxR.Value = 255;
this.tbMaxR.ValueChanged += new System.EventHandler(this.tbMaxR_ValueChanged);
//
// tbMaxG
//
this.tbMaxG.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.tbMaxG.Location = new System.Drawing.Point(145, 200);
this.tbMaxG.Maximum = 255;
this.tbMaxG.Name = "tbMaxG";
this.tbMaxG.Size = new System.Drawing.Size(141, 45);
this.tbMaxG.TabIndex = 37;
this.tbMaxG.TickStyle = System.Windows.Forms.TickStyle.None;
this.tbMaxG.Value = 255;
this.tbMaxG.ValueChanged += new System.EventHandler(this.tbMaxG_ValueChanged);
//
// tbMinG
//
this.tbMinG.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.tbMinG.Location = new System.Drawing.Point(145, 147);
this.tbMinG.Maximum = 255;
this.tbMinG.Name = "tbMinG";
this.tbMinG.Size = new System.Drawing.Size(141, 45);
this.tbMinG.TabIndex = 36;
this.tbMinG.TickStyle = System.Windows.Forms.TickStyle.None;
this.tbMinG.ValueChanged += new System.EventHandler(this.tbMinG_ValueChanged);
//
// tbMaxB
//
this.tbMaxB.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.tbMaxB.Location = new System.Drawing.Point(145, 306);
this.tbMaxB.Maximum = 255;
this.tbMaxB.Name = "tbMaxB";
this.tbMaxB.Size = new System.Drawing.Size(141, 45);
this.tbMaxB.TabIndex = 39;
this.tbMaxB.TickStyle = System.Windows.Forms.TickStyle.None;
this.tbMaxB.Value = 255;
this.tbMaxB.ValueChanged += new System.EventHandler(this.tbMaxB_ValueChanged);
//
// tbMinB
//
this.tbMinB.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.tbMinB.Location = new System.Drawing.Point(145, 253);
this.tbMinB.Maximum = 255;
this.tbMinB.Name = "tbMinB";
this.tbMinB.Size = new System.Drawing.Size(141, 45);
this.tbMinB.TabIndex = 38;
this.tbMinB.TickStyle = System.Windows.Forms.TickStyle.None;
this.tbMinB.ValueChanged += new System.EventHandler(this.tbMinB_ValueChanged);
//
// AoiRgbControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(312, 700);
this.ClientSize = new System.Drawing.Size(312, 831);
this.Controls.Add(this.btnUpdate);
this.Controls.Add(this.flatLabel9);
this.Controls.Add(this.txtRate);
this.Controls.Add(this.flatLabel7);
this.Controls.Add(this.txtMaxB);
this.Controls.Add(this.txtMinB);
this.Controls.Add(this.flatLabel8);
this.Controls.Add(this.flatLabel4);
this.Controls.Add(this.txtMaxG);
this.Controls.Add(this.txtMinG);
this.Controls.Add(this.flatLabel6);
this.Controls.Add(this.flatLabel1);
this.Controls.Add(this.txtMaxR);
this.Controls.Add(this.txtMinR);
this.Controls.Add(this.flatLabel2);
this.Controls.Add(this.flatLabel5);
this.Controls.Add(this.txtmaxRate);
......@@ -273,6 +368,7 @@
this.Controls.Add(this.flatLabel3);
this.Name = "AoiRgbControl";
this.TitleName = "颜色抽取";
this.Controls.SetChildIndex(this.panControl, 0);
this.Controls.SetChildIndex(this.aoiImage, 0);
this.Controls.SetChildIndex(this.panParam, 0);
this.Controls.SetChildIndex(this.panResult, 0);
......@@ -281,20 +377,17 @@
this.Controls.SetChildIndex(this.txtmaxRate, 0);
this.Controls.SetChildIndex(this.flatLabel5, 0);
this.Controls.SetChildIndex(this.flatLabel2, 0);
this.Controls.SetChildIndex(this.txtMinR, 0);
this.Controls.SetChildIndex(this.txtMaxR, 0);
this.Controls.SetChildIndex(this.flatLabel1, 0);
this.Controls.SetChildIndex(this.flatLabel6, 0);
this.Controls.SetChildIndex(this.txtMinG, 0);
this.Controls.SetChildIndex(this.txtMaxG, 0);
this.Controls.SetChildIndex(this.flatLabel4, 0);
this.Controls.SetChildIndex(this.flatLabel8, 0);
this.Controls.SetChildIndex(this.txtMinB, 0);
this.Controls.SetChildIndex(this.txtMaxB, 0);
this.Controls.SetChildIndex(this.flatLabel7, 0);
this.Controls.SetChildIndex(this.txtRate, 0);
this.Controls.SetChildIndex(this.flatLabel9, 0);
this.Controls.SetChildIndex(this.btnUpdate, 0);
this.panParam.ResumeLayout(false);
this.panParam.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.tbMinR)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tbMaxR)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tbMaxG)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tbMinG)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tbMaxB)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tbMinB)).EndInit();
this.ResumeLayout(false);
}
......@@ -320,5 +413,11 @@
private Asa.Theme.FlatText txtRate;
private Asa.Theme.FlatLabel flatLabel9;
private Asa.Theme.FlatButton btnUpdate;
private System.Windows.Forms.TrackBar tbMinR;
private System.Windows.Forms.TrackBar tbMaxR;
private System.Windows.Forms.TrackBar tbMaxB;
private System.Windows.Forms.TrackBar tbMinB;
private System.Windows.Forms.TrackBar tbMaxG;
private System.Windows.Forms.TrackBar tbMinG;
}
}
......@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AOI;
using Asa.Theme;
namespace AccAOI.control
{
......@@ -23,12 +24,18 @@ namespace AccAOI.control
if (this.AoiInfo is AoiMethodRgb)
{
methodRgb = (AoiMethodRgb)AoiInfo;
txtMinR.Text = methodRgb.minR.ToString();
txtMaxR.Text = methodRgb.maxR.ToString();
txtMinG.Text = methodRgb.minG.ToString();
txtMaxG.Text = methodRgb.maxG.ToString();
txtMaxB.Text = methodRgb.maxB.ToString();
txtMinB.Text = methodRgb.minB.ToString();
//txtMinR.Text = methodRgb.minR.ToString();
//txtMaxR.Text = methodRgb.maxR.ToString();
//txtMinG.Text = methodRgb.minG.ToString();
// txtMaxG.Text = methodRgb.maxG.ToString();
// txtMaxB.Text = methodRgb.maxB.ToString();
// txtMinB.Text = methodRgb.minB.ToString();
SetTbValue(tbMinR, methodRgb.minR);
SetTbValue(tbMaxR, methodRgb.maxR);
SetTbValue(tbMinG, methodRgb.minG);
SetTbValue(tbMaxG, methodRgb.maxG);
SetTbValue(tbMaxB, methodRgb.maxB);
SetTbValue(tbMinB, methodRgb.minB);
txtminRate.Text = methodRgb.minRate.ToString();
txtmaxRate.Text = methodRgb.maxRate.ToString();
}
......@@ -46,6 +53,12 @@ namespace AccAOI.control
methodRgb.maxG = FormUtil.GetIntValue(txtMaxG);
methodRgb.maxB = FormUtil.GetIntValue(txtMaxB);
methodRgb.minB = FormUtil.GetIntValue(txtMinB);
SetTbValue(tbMinR, methodRgb.minR);
SetTbValue(tbMaxR, methodRgb.maxR);
SetTbValue(tbMinG, methodRgb.minG);
SetTbValue(tbMaxG, methodRgb.maxG);
SetTbValue(tbMaxB, methodRgb.maxB);
SetTbValue(tbMinB, methodRgb.minB);
methodRgb.minRate = FormUtil.GetIntValue(txtminRate);
methodRgb.maxRate = FormUtil.GetIntValue(txtmaxRate);
if (currPath != null)
......@@ -59,8 +72,12 @@ namespace AccAOI.control
private void UpdateImage()
public override void UpdateImage()
{
if (BaseImage == null)
{
return;
}
GetAoiInfo();
Image outImage = null;
float rate = methodRgb.GetRate(BaseImage, out outImage);
......@@ -78,5 +95,52 @@ namespace AccAOI.control
{
UpdateImage();
}
private void tbMinR_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinR, tbMinR.Value);
}
private void tbMaxR_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxR, tbMaxR.Value);
}
private void tbMinG_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinG, tbMinG.Value);
}
private void tbMaxG_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxG, tbMaxG.Value);
}
private void tbMinB_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinB, tbMinB.Value);
}
private void tbMaxB_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxB, tbMaxB.Value);
}
private void SetText(FlatText text, int value)
{
if (text.Text.ToString().Equals(value.ToString()))
{
return;
}
text.Text = value.ToString();
}
private void SetTbValue(TrackBar tb, int value)
{
if (tb.Value.Equals(value.ToString()))
{
return;
}
tb.Value = value;
}
}
}
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!