Commit adc71ed4 LN

界面修改

1 个父辈 9d204c24
......@@ -44,6 +44,7 @@ namespace AccAOI
this.panAoi = new System.Windows.Forms.Panel();
this.imageBox1 = new Acc.ImageBox.AccImageBox();
this.btnExcute = new Asa.Theme.FlatButton();
this.btnDel = new Asa.Theme.FlatButton();
this.SuspendLayout();
//
// aoiList
......@@ -183,10 +184,23 @@ namespace AccAOI
this.btnExcute.Text = "执行";
this.btnExcute.Click += new System.EventHandler(this.btnExcute_Click);
//
// btnDel
//
this.btnDel.ImageSize = new System.Drawing.Size(0, 0);
this.btnDel.Inside = false;
this.btnDel.Location = new System.Drawing.Point(28, 187);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(109, 30);
this.btnDel.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnDel.TabIndex = 17;
this.btnDel.Text = "删除";
this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
//
// FrmAoiSetting
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1271, 641);
this.Controls.Add(this.btnDel);
this.Controls.Add(this.btnExcute);
this.Controls.Add(this.panAoi);
this.Controls.Add(this.comType);
......@@ -222,5 +236,6 @@ namespace AccAOI
private Asa.Theme.FlatCombo comType;
private System.Windows.Forms.Panel panAoi;
private Asa.Theme.FlatButton btnExcute;
private Asa.Theme.FlatButton btnDel;
}
}
\ No newline at end of file
......@@ -290,60 +290,15 @@ namespace AccAOI
{
return;
}
//Matrix translateMatrix = new Matrix();
//translateMatrix.Translate(100, 0);
//RectangleF region = imageBox1.SelectionRegion;
//currPath = new GraphicsPath();
//if (aoiControl.AreaType.Equals(1))
//{
// currPath.AddRectangle(region);
//}
//else
//{
// currPath.AddEllipse(region);
//}
currPath = imageBox1.SelectionRegion;
//Image threshImage = CutImage(Img , currPath);
//cutImage = threshImage;
currPath = imageBox1.SelectionRegion;
aoiControl.SetCurrPath( currPath);
}catch(Exception ex)
{
}
}
//private Image CutImage(Image src, GraphicsPath path)
//{
// try
// {
// var bounds = path.GetBounds();
// Bitmap b = new Bitmap(src.Width, src.Height);
// using (Graphics g = Graphics.FromImage(b))
// {
// var br = new TextureBrush(src);
// g.FillPath(br, path);
// }
// if (bounds.Width > 0 && bounds.Height > 0)
// {
// Bitmap result = new Bitmap((int)bounds.Width, (int)bounds.Height);
// var srcRect = bounds;
// var dstRect = new RectangleF(0, 0, bounds.Width, bounds.Height);
// bounds.Location = System.Drawing.Point.Empty;
// using (Graphics g = Graphics.FromImage(result))
// {
// bounds.Location = System.Drawing.Point.Empty;
// g.DrawImage(b, dstRect, srcRect, GraphicsUnit.Pixel);
// }
// return result;
// }
// }catch(Exception ex)
// {
// Console.WriteLine("CutImage出错:" + ex.ToString());
// }
// return null;
//}
private void btnExcute_Click(object sender, EventArgs e)
{
SaveCurrAoi();
......@@ -365,5 +320,29 @@ namespace AccAOI
}
CanSel = true;
}
private void btnDel_Click(object sender, EventArgs e)
{
if (Img == null)
{
return;
}
if (this.Project == null)
{
return;
}
if (this.aoiControl != null)
{
DialogResult result= MessageBox.Show("确定删除 " + aoiControl.AoiInfo.MethodName + " ?", "确认提示", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK))
{
if (Project.methodMap.ContainsKey(aoiControl.AoiInfo.MethodName))
{
Project.methodMap.Remove(aoiControl.AoiInfo.MethodName);
ShowPorject();
}
}
}
}
}
}
......@@ -31,25 +31,28 @@
this.flatLabel1 = new Asa.Theme.FlatLabel();
this.flatTextSearch = new Asa.Theme.FlatText();
this.flatLabel2 = new Asa.Theme.FlatLabel();
this.label1 = new System.Windows.Forms.Label();
this.lblResult = new System.Windows.Forms.Label();
this.btnTest = new Asa.Theme.FlatButton();
this.panParam.SuspendLayout();
this.panResult.SuspendLayout();
this.SuspendLayout();
//
// panParam
//
this.panParam.Controls.Add(this.label1);
this.panParam.Controls.Add(this.flatLabel2);
this.panParam.Controls.Add(this.flatTextSearch);
this.panParam.Controls.Add(this.flatLabel1);
//
// panResult
//
this.panResult.Controls.Add(this.btnTest);
this.panResult.Controls.Add(this.lblResult);
this.panResult.Size = new System.Drawing.Size(298, 197);
//
// flatLabel1
//
this.flatLabel1.Inside = false;
this.flatLabel1.Location = new System.Drawing.Point(9, 33);
this.flatLabel1.Location = new System.Drawing.Point(14, 50);
this.flatLabel1.Name = "flatLabel1";
this.flatLabel1.Size = new System.Drawing.Size(80, 30);
this.flatLabel1.TabIndex = 0;
......@@ -59,7 +62,7 @@
//
this.flatTextSearch.Font = new System.Drawing.Font("宋体", 9F);
this.flatTextSearch.Inside = false;
this.flatTextSearch.Location = new System.Drawing.Point(170, 33);
this.flatTextSearch.Location = new System.Drawing.Point(175, 50);
this.flatTextSearch.Name = "flatTextSearch";
this.flatTextSearch.Size = new System.Drawing.Size(95, 30);
this.flatTextSearch.TabIndex = 1;
......@@ -68,22 +71,34 @@
// flatLabel2
//
this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(104, 33);
this.flatLabel2.Location = new System.Drawing.Point(109, 50);
this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(65, 30);
this.flatLabel2.TabIndex = 2;
this.flatLabel2.Text = "Mark区域x";
//
// label1
// lblResult
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("黑体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(70, 92);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(162, 24);
this.label1.TabIndex = 4;
this.label1.Text = "Mark区域无效";
this.lblResult.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.lblResult.Font = new System.Drawing.Font("黑体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.ForeColor = System.Drawing.Color.Red;
this.lblResult.Location = new System.Drawing.Point(39, 100);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(231, 24);
this.lblResult.TabIndex = 4;
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnTest
//
this.btnTest.ImageSize = new System.Drawing.Size(0, 0);
this.btnTest.Inside = false;
this.btnTest.Location = new System.Drawing.Point(104, 46);
this.btnTest.Name = "btnTest";
this.btnTest.Size = new System.Drawing.Size(90, 30);
this.btnTest.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnTest.TabIndex = 5;
this.btnTest.Text = "测试结果";
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
//
// AioMarkControl
//
......@@ -93,7 +108,7 @@
this.Name = "AioMarkControl";
this.TitleName = "Mark设置";
this.panParam.ResumeLayout(false);
this.panParam.PerformLayout();
this.panResult.ResumeLayout(false);
this.ResumeLayout(false);
}
......@@ -103,6 +118,7 @@
private Asa.Theme.FlatLabel flatLabel2;
private Asa.Theme.FlatText flatTextSearch;
private Asa.Theme.FlatLabel flatLabel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblResult;
private Asa.Theme.FlatButton btnTest;
}
}
......@@ -25,5 +25,26 @@ namespace AccAOI.control
}
return base.GetAoiInfo();
}
private void btnTest_Click(object sender, EventArgs e)
{
if (this.AoiInfo is AoiMarkMethod)
{
AoiMarkMethod mark = (AoiMarkMethod)AoiInfo;
Image result= mark.FixImage(FrmAoiSetting.Img, FrmAoiSetting.Img);
if (result == null)
{
lblResult.ForeColor = Color.Red ;
lblResult.Text = "Mark区域无效";
}
else
{
lblResult.ForeColor = Color.Green;
lblResult.Text = "OK";
this.aoiImage.Image = result;
}
}
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!