Commit 0fd83219 LN

增加名称编辑功能

1 个父辈 044dc943
...@@ -67,14 +67,17 @@ namespace AOI ...@@ -67,14 +67,17 @@ namespace AOI
} }
using (Graphics g = Graphics.FromImage(image)) using (Graphics g = Graphics.FromImage(image))
{ {
foreach(ResultBean resultBean in resultBeans) foreach (ResultBean resultBean in resultBeans)
{ {
Pen pen = new Pen(Color.Lime,5); Pen pen = new Pen(Color.Lime, 5);
if (!resultBean.result) if (!resultBean.result)
{ {
pen = new Pen(Color.Red,5); pen = new Pen(Color.Red, 5);
}
if (resultBean.roiPath != null)
{
g.DrawPath(pen, resultBean.roiPath);
} }
g.DrawPath(pen,resultBean.roiPath);
} }
} }
resultImg = image; resultImg = image;
......
...@@ -10,6 +10,14 @@ namespace AOI ...@@ -10,6 +10,14 @@ namespace AOI
{ {
public class ResultBean public class ResultBean
{ {
public ResultBean(string name)
{
this.MethodName = name;
}
/// <summary>
/// 名称
/// </summary>
public string MethodName;
/// <summary> /// <summary>
/// AOI标识 /// AOI标识
/// </summary> /// </summary>
......
...@@ -43,7 +43,7 @@ namespace AOI ...@@ -43,7 +43,7 @@ namespace AOI
public override ResultBean Check(Image standardImage, Image imageToCheck) public override ResultBean Check(Image standardImage, Image imageToCheck)
{ {
ResultBean resultBean = new ResultBean(); ResultBean resultBean = new ResultBean(MethodName);
bool needCut = true; bool needCut = true;
Image standardRoiImg = GetRoiImage(standardImage, needCut); Image standardRoiImg = GetRoiImage(standardImage, needCut);
resultBean.standardRoiImage = standardRoiImg; resultBean.standardRoiImage = standardRoiImg;
......
...@@ -69,7 +69,7 @@ namespace AOI ...@@ -69,7 +69,7 @@ namespace AOI
/// <returns></returns> /// <returns></returns>
public override ResultBean Check(Image standardImage, Image imageToCheck) public override ResultBean Check(Image standardImage, Image imageToCheck)
{ {
ResultBean resultBean = new ResultBean(); ResultBean resultBean = new ResultBean(MethodName);
resultBean.standardRoiImage = standardImage; resultBean.standardRoiImage = standardImage;
Image resultImage = FixImage(standardImage, imageToCheck); Image resultImage = FixImage(standardImage, imageToCheck);
if(resultImage != null) if(resultImage != null)
......
...@@ -23,7 +23,7 @@ namespace AOI ...@@ -23,7 +23,7 @@ namespace AOI
public override ResultBean Check(Image standardImage, Image imageToCheck) public override ResultBean Check(Image standardImage, Image imageToCheck)
{ {
ResultBean resultBean = new ResultBean(); ResultBean resultBean = new ResultBean(MethodName);
bool needCut = true; bool needCut = true;
Image standardRoiImg = GetRoiImage(standardImage, needCut); Image standardRoiImg = GetRoiImage(standardImage, needCut);
resultBean.standardRoiImage = standardRoiImg; resultBean.standardRoiImage = standardRoiImg;
......
...@@ -40,7 +40,7 @@ namespace AOI ...@@ -40,7 +40,7 @@ namespace AOI
public override ResultBean Check(Image standardImage, Image imageToCheck) public override ResultBean Check(Image standardImage, Image imageToCheck)
{ {
ResultBean resultBean = new ResultBean(); ResultBean resultBean = new ResultBean(MethodName);
bool needCut = true; bool needCut = true;
Image standardRoiImg = GetRoiImage(standardImage, needCut); Image standardRoiImg = GetRoiImage(standardImage, needCut);
resultBean.standardRoiImage = standardRoiImg; resultBean.standardRoiImage = standardRoiImg;
......
...@@ -110,6 +110,12 @@ ...@@ -110,6 +110,12 @@
<DependentUpon>FrmAoiSetting.cs</DependentUpon> <DependentUpon>FrmAoiSetting.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="camera\HIKCamera.cs" /> <Compile Include="camera\HIKCamera.cs" />
<Compile Include="FrmMethodName.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMethodName.Designer.cs">
<DependentUpon>FrmMethodName.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="control\AioTempMatchControl.resx"> <EmbeddedResource Include="control\AioTempMatchControl.resx">
...@@ -130,6 +136,9 @@ ...@@ -130,6 +136,9 @@
<EmbeddedResource Include="FrmAoiSetting.resx"> <EmbeddedResource Include="FrmAoiSetting.resx">
<DependentUpon>FrmAoiSetting.cs</DependentUpon> <DependentUpon>FrmAoiSetting.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmMethodName.resx">
<DependentUpon>FrmMethodName.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
...@@ -293,14 +293,27 @@ namespace AccAOI ...@@ -293,14 +293,27 @@ namespace AccAOI
return; return;
} }
string text = comType.Text; string text = comType.Text;
CloseCurrAoi();
AoiMethod methodInfo = ControlUtil.GetMethod(text); AoiMethod methodInfo = ControlUtil.GetMethod(text);
methodInfo.MethodName = Project.methodMap.Values.Count.ToString().PadLeft(2, '0') + "_" + text; string defaultName = Project.methodMap.Values.Count.ToString().PadLeft(2, '0') + "_" + text;
FrmMethodName frmName = new FrmMethodName(defaultName, new List<string>(Project.methodMap.Keys));
frmName.Text = "请输入新增【"+ text + "】方法的名称";
DialogResult result = frmName.ShowDialog();
if (result.Equals(DialogResult.OK))
{
methodInfo.MethodName = frmName.MethodName;
}
else
{
return;
}
CloseCurrAoi();
// methodInfo.MethodName = Project.methodMap.Values.Count.ToString().PadLeft(2, '0') + "_" + text;
Project.methodMap.Add(methodInfo.MethodName, methodInfo); Project.methodMap.Add(methodInfo.MethodName, methodInfo);
ShowAoi(methodInfo); ShowAoi(methodInfo);
aoiList.ItemAdd(aoiControl.TitleName); aoiList.ItemAdd(aoiControl.TitleName);
aoiList.SelectedIndex = Project.methodMap.Count - 1;
if (imageBox1.Visible.Equals(false)) if (imageBox1.Visible.Equals(false))
{ {
btnImageChange_Click(null, null); btnImageChange_Click(null, null);
...@@ -386,7 +399,7 @@ namespace AccAOI ...@@ -386,7 +399,7 @@ namespace AccAOI
aoiList.ItemAdd(key); aoiList.ItemAdd(key);
if (index.Equals(0)) if (index.Equals(0))
{ {
aoiList.Index = index; aoiList.SelectedIndex = index;
ShowAoi(Project.methodMap[key]); ShowAoi(Project.methodMap[key]);
} }
index++; index++;
...@@ -399,9 +412,9 @@ namespace AccAOI ...@@ -399,9 +412,9 @@ namespace AccAOI
} }
} }
private void aoiList_IndexChanged(object sender, EventArgs e) private void aoiList_IndexChanged(object sender )
{ {
int index = aoiList.Index; int index = aoiList.SelectedIndex;
if (index >= 0 && (Project != null)) if (index >= 0 && (Project != null))
{ {
List<AoiMethod> methods = new List<AoiMethod>(Project.methodMap.Values); List<AoiMethod> methods = new List<AoiMethod>(Project.methodMap.Values);
...@@ -599,6 +612,55 @@ namespace AccAOI ...@@ -599,6 +612,55 @@ namespace AccAOI
{ {
btnImageChange_Click(null, null); btnImageChange_Click(null, null);
} }
} }
private void btnUpdateName_Click(object sender, EventArgs e)
{
int index = aoiList.SelectedIndex;
if (index >= 0 && (Project != null)&&(aoiControl!=null))
{
List<AoiMethod> methods = new List<AoiMethod>(Project.methodMap.Values);
if (index < methods.Count)
{
// AoiMethod method = methods[index];
string oldName = methods[index].MethodName;
List<string> allName = new List<string>(Project.methodMap.Keys);
allName.Remove(oldName);
FrmMethodName frmName = new FrmMethodName(oldName, allName);
frmName.Text = "请输入修改后的名称";
DialogResult result = frmName.ShowDialog();
if (result.Equals(DialogResult.OK))
{
string newName= frmName.MethodName;
if (newName.Equals(oldName))
{
return;
}
methods[index].MethodName = newName;
//Project.methodMap.Remove(oldName);
//Project.methodMap.Add(newName, method);
Project.methodMap.Clear();
aoiList.ItemClear();
foreach(AoiMethod m in methods)
{
Project.methodMap.Add(m.MethodName, m);
aoiList.ItemAdd(m.MethodName);
}
aoiControl.TitleName = newName;
}
else
{
return;
}
}
if (imageBox1.Visible.Equals(false))
{
btnImageChange_Click(null, null);
}
}
}
} }
} }
namespace AccAOI
{
partial class FrmMethodName
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtName = new Asa.Theme.FlatText();
this.btnCancel = new Asa.Theme.FlatButton();
this.btnOk = new Asa.Theme.FlatButton();
this.SuspendLayout();
//
// txtName
//
this.txtName.Font = new System.Drawing.Font("宋体", 9F);
this.txtName.Inside = false;
this.txtName.Location = new System.Drawing.Point(63, 60);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(174, 30);
this.txtName.TabIndex = 0;
//
// btnCancel
//
this.btnCancel.ImageSize = new System.Drawing.Size(0, 0);
this.btnCancel.Inside = false;
this.btnCancel.Location = new System.Drawing.Point(44, 116);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(80, 30);
this.btnCancel.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOk
//
this.btnOk.ImageSize = new System.Drawing.Size(0, 0);
this.btnOk.Inside = false;
this.btnOk.Location = new System.Drawing.Point(168, 116);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(80, 30);
this.btnOk.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnOk.TabIndex = 2;
this.btnOk.Text = "确定";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// FrmMethodName
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 172);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.txtName);
this.Location = new System.Drawing.Point(0, 0);
this.Minimized = false;
this.Name = "FrmMethodName";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "请输入方法名称";
this.Load += new System.EventHandler(this.FrmMethodName_Load);
this.ResumeLayout(false);
}
#endregion
private Asa.Theme.FlatText txtName;
private Asa.Theme.FlatButton btnCancel;
private Asa.Theme.FlatButton btnOk;
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AccAOI
{
public partial class FrmMethodName : Asa.Theme.FlatForm
{
public string MethodName = "";
public List<string> AllNameList = new List<string>();
public FrmMethodName(string name, List<string> names )
{
InitializeComponent();
MethodName = name;
AllNameList = names;
}
private void FrmMethodName_Load(object sender, EventArgs e)
{
txtName.Text = MethodName;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void btnOk_Click(object sender, EventArgs e)
{
string newName = txtName.Text;
if (AllNameList.Contains(newName))
{
MessageBox.Show("名称【"+newName+"】已存在,请重新输入");
txtName.Focus();
return;
}
MethodName = newName;
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -46,6 +46,8 @@ namespace AccAOI.control ...@@ -46,6 +46,8 @@ namespace AccAOI.control
// //
// btnSetArea // btnSetArea
// //
this.btnSetArea.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnSetArea.Font = new System.Drawing.Font("宋体", 9F);
this.btnSetArea.ImageSize = new System.Drawing.Size(0, 0); this.btnSetArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnSetArea.Inside = false; this.btnSetArea.Inside = false;
this.btnSetArea.Location = new System.Drawing.Point(104, 30); this.btnSetArea.Location = new System.Drawing.Point(104, 30);
...@@ -58,6 +60,8 @@ namespace AccAOI.control ...@@ -58,6 +60,8 @@ namespace AccAOI.control
// //
// btnClearArea // btnClearArea
// //
this.btnClearArea.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnClearArea.Font = new System.Drawing.Font("宋体", 9F);
this.btnClearArea.ImageSize = new System.Drawing.Size(0, 0); this.btnClearArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnClearArea.Inside = false; this.btnClearArea.Inside = false;
this.btnClearArea.Location = new System.Drawing.Point(204, 274); this.btnClearArea.Location = new System.Drawing.Point(204, 274);
...@@ -109,6 +113,8 @@ namespace AccAOI.control ...@@ -109,6 +113,8 @@ namespace AccAOI.control
// //
// btnImgType // btnImgType
// //
this.btnImgType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnImgType.Font = new System.Drawing.Font("宋体", 9F);
this.btnImgType.ImageSize = new System.Drawing.Size(0, 0); this.btnImgType.ImageSize = new System.Drawing.Size(0, 0);
this.btnImgType.Inside = false; this.btnImgType.Inside = false;
this.btnImgType.Location = new System.Drawing.Point(9, 30); this.btnImgType.Location = new System.Drawing.Point(9, 30);
...@@ -148,6 +154,7 @@ namespace AccAOI.control ...@@ -148,6 +154,7 @@ namespace AccAOI.control
// //
this.aoiImage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | 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))); | System.Windows.Forms.AnchorStyles.Right)));
this.aoiImage.ImeMode = System.Windows.Forms.ImeMode.On;
this.aoiImage.Location = new System.Drawing.Point(9, 53); this.aoiImage.Location = new System.Drawing.Point(9, 53);
this.aoiImage.Name = "aoiImage"; this.aoiImage.Name = "aoiImage";
this.aoiImage.Size = new System.Drawing.Size(288, 182); this.aoiImage.Size = new System.Drawing.Size(288, 182);
......
...@@ -99,7 +99,7 @@ namespace AccAOI.control ...@@ -99,7 +99,7 @@ namespace AccAOI.control
BImageBox.SelectNone(); BImageBox.SelectNone();
} }
private void btnImgType_Click(object sender, EventArgs e) private void btnImgType_Click(object sender, EventArgs e)
{ {
if (btnImgType.Text.Equals("原图")) { if (btnImgType.Text.Equals("原图")) {
ShowImageType = 1; ShowImageType = 1;
...@@ -114,6 +114,29 @@ namespace AccAOI.control ...@@ -114,6 +114,29 @@ namespace AccAOI.control
} }
UpdateImage(); UpdateImage();
} }
/// <summary>
/// 1=原图,2-效果图
/// </summary>
/// <param name="type"></param>
internal void SetCurrImageType(int type)
{
if (ShowImageType.Equals(type))
{
return;
}
if (type.Equals(1))
{
ShowImageType = 1;
btnImgType.Text = "效果图";
panAreaImage.Text = "区域图 - 原图";
}
else
{
ShowImageType = 2;
btnImgType.Text = "原图";
panAreaImage.Text = "区域图像 - 效果图";
}
}
} }
} }
...@@ -50,6 +50,7 @@ namespace AccAOI.control ...@@ -50,6 +50,7 @@ namespace AccAOI.control
flatTextSearchZoom.Text = method.SearchPathZoom.ToString(); flatTextSearchZoom.Text = method.SearchPathZoom.ToString();
IsShowOk = true; IsShowOk = true;
SetCurrImageType(1);
UpdateImage(); UpdateImage();
} }
...@@ -85,6 +86,7 @@ namespace AccAOI.control ...@@ -85,6 +86,7 @@ namespace AccAOI.control
} }
else else
{ {
SetCurrImageType(2);
lblResult.ForeColor = Color.Green; lblResult.ForeColor = Color.Green;
lblResult.Text = "OK" ; lblResult.Text = "OK" ;
this.aoiImage.Image = result; this.aoiImage.Image = result;
...@@ -117,6 +119,15 @@ namespace AccAOI.control ...@@ -117,6 +119,15 @@ namespace AccAOI.control
AoiMarkMethod markMethod= (AoiMarkMethod)AoiInfo; AoiMarkMethod markMethod= (AoiMarkMethod)AoiInfo;
GraphicsPath searchPath = markMethod.GetSearchPath(); GraphicsPath searchPath = markMethod.GetSearchPath();
BImageBox.ShowPath(searchPath, Color.Yellow); BImageBox.ShowPath(searchPath, Color.Yellow);
if (ShowImageType.Equals(1))
{
Image cutImage = markMethod.GetRoiImage(BaseImage, true);
aoiImage.Image = cutImage;
}
else
{
aoiImage.Image = null;
}
GC.Collect(); GC.Collect();
} }
......
...@@ -48,6 +48,7 @@ namespace AccAOI.control ...@@ -48,6 +48,7 @@ namespace AccAOI.control
trackBarSamePercent.Value = (int)method.SamePercent; trackBarSamePercent.Value = (int)method.SamePercent;
IsShowOk = true; IsShowOk = true;
SetCurrImageType(1);
UpdateImage(); UpdateImage();
} }
...@@ -87,6 +88,7 @@ namespace AccAOI.control ...@@ -87,6 +88,7 @@ namespace AccAOI.control
lblResult.Text =result.result? "OK":"NG" ; lblResult.Text =result.result? "OK":"NG" ;
if (result.currentRoiImage != null) if (result.currentRoiImage != null)
{ {
SetCurrImageType(2);
this.aoiImage.Image = result.currentRoiImage; this.aoiImage.Image = result.currentRoiImage;
} }
} }
...@@ -117,7 +119,15 @@ namespace AccAOI.control ...@@ -117,7 +119,15 @@ namespace AccAOI.control
AoiTemplateMethod MatchMethod = (AoiTemplateMethod)AoiInfo; AoiTemplateMethod MatchMethod = (AoiTemplateMethod)AoiInfo;
MatchMethod.RoiPath = currPath; MatchMethod.RoiPath = currPath;
if (ShowImageType.Equals(1))
{
Image cutImage = MatchMethod.GetRoiImage(BaseImage, true);
aoiImage.Image = cutImage;
}
else
{
aoiImage.Image = null;
}
GC.Collect(); GC.Collect();
} }
......
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!