Commit 2abc79a3 LN

增加中英文处理

1 个父辈 0fd83219
......@@ -132,7 +132,7 @@ namespace AOI
string imageFile = GetStandardImgPath(filePath);
if (!File.Exists(imageFile))
{
msg = "未找到基准图片";
msg = "no image ";
return null;
}
Image image = Image.FromFile(imageFile);
......
......@@ -24,8 +24,10 @@ namespace AOIProject
//string path = "F:\\Data\\";
//string filename = "F:\\Data\\11111.data";
AccAOI.camera.CameraManager.LoadCamera();
AOIResourceCulture.SetCurrentCulture(AOIResourceCulture.English);
Application.Run(new FrmAoiSetting(filename, null,path));
AccAOI.camera.CameraManager.CloseCamera();
AOIResourceCulture.LogDefaultMap();
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AccAOI
{
public class AOIResourceCulture
{
public static string China = "zh-CN";
public static string English = "en-US";
public static string CurrLanguage = "zh-CN";
public static Dictionary<string, string> defaultMap = new Dictionary<string, string>();
private static Dictionary<string, Dictionary<string, string>> ResourceMap = null;
public static bool OpenResourceLog = false;
private static Dictionary<string, string> englishMap = new Dictionary<string, string>();
public static void SetCurrentCulture(string name)
{
if (string.IsNullOrEmpty(name))
{
name = "zh-CN";
}
CurrLanguage = name;
Thread.CurrentThread.CurrentCulture = new CultureInfo(name);
if (ResourceMap == null)
{
LoadData();
}
ControlType.Mark = AOIResourceCulture.GetValue("Mark点设置");
ControlType.AOIBlob = AOIResourceCulture.GetValue("斑点分析");
ControlType.AOIRGB = AOIResourceCulture.GetValue("颜色抽取");
ControlType.Match = AOIResourceCulture.GetValue("模板匹配");
}
private static void LoadData()
{
try
{
string englishPath = Application.StartupPath + @"\Properties\en-US.resource";
string chinaPath = Application.StartupPath + @"\Properties\zh-CN.resource";
Dictionary<string, string> ChinaMap = LoadDataMap(chinaPath);
Dictionary<string, string> EnglishMap = LoadDataMap(englishPath);
ResourceMap = new Dictionary<string, Dictionary<string, string>>();
ResourceMap.Add(China, ChinaMap);
ResourceMap.Add(English, EnglishMap);
List<string> allList = new List<string>();
foreach (string key in ChinaMap.Keys)
{
string str = key + "=" + ChinaMap[key];
if (EnglishMap.ContainsKey(key))
{
str += "=" + EnglishMap[key];
}
allList.Add(str);
}
foreach (string key in EnglishMap.Keys)
{
if (ChinaMap.ContainsKey(key))
{
continue;
}
else
{
string str = key + "=" + " " + "=" + EnglishMap[key];
allList.Add(str);
}
}
string filepath = Application.StartupPath + "\\logs\\";
if (!Directory.Exists(filepath))
{
Directory.CreateDirectory(filepath);
}
File.WriteAllLines(filepath + "AOIResources.txt", allList.ToArray());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
private static Dictionary<string, string> LoadDataMap(string path)
{
Dictionary<string, string> map = new Dictionary<string, string>();
try
{
if (!File.Exists(path))
{
Console.WriteLine("文件【" + path + "】不存在");
return map;
}
string[] lines = File.ReadAllLines(path);
int i = 1;
char spilt = '=';
foreach (string line in lines)
{
if (String.IsNullOrEmpty(line))
{
continue;
}
int index = line.IndexOf(spilt);
if (index <= 0)
{
Console.WriteLine("文件【" + path + "】第【" + i + "】行数据【" + line + "】解析失败");
continue;
}
string key = line.Substring(0, index);
string value = line.Substring(index + 1, line.Length - index - 1);
if (String.IsNullOrEmpty(key.Trim()) || String.IsNullOrEmpty(value.ToString()))
{
continue;
}
if (map.ContainsKey(key.Trim()))
{
map.Remove(key.Trim());
}
map.Add(key.Trim(), value.Trim());
i++;
}
Console.WriteLine("文件【" + path + "】加载完成,长度【" + map.Count + "】");
}
catch (Exception ex)
{
Console.WriteLine("加载中英文资源出错:" + ex.ToString());
}
return map;
}
public static string GetString(string id, string defaultStr)
{
string strCurLanguage = defaultStr;
try
{
if (!ResourceMap.ContainsKey(CurrLanguage))
{
NoIdLog(id, defaultStr);
return defaultStr;
}
else
{
if (ResourceMap[CurrLanguage].ContainsKey(id.Trim()))
{
strCurLanguage = ResourceMap[CurrLanguage][id];
}
else
{
NoIdLog(id, defaultStr);
}
}
return strCurLanguage;
}
catch (Exception ex)
{
NoIdLog(id, defaultStr);
}
return strCurLanguage;
}
public static string GetString(string id, string defaultStr, params object[] param)
{
string strCurLanguage = GetString(id, defaultStr);
return String.Format(strCurLanguage, param);
}
private static void NoIdLog(string id, string defaultStr)
{
if (defaultStr.Trim().Equals(""))
{
return;
}
if (!defaultMap.ContainsKey(id))
{
defaultMap.Add(id, defaultStr);
}
}
public static void LogDefaultMap()
{
Console.WriteLine("开始打印缺少的文字配置" + defaultMap.Count);
List<string> lines = new List<string>();
foreach (string key in defaultMap.Keys)
{
string value = defaultMap[key];
lines.Add("" + key + "=" + value + "");
}
string filepath = Application.StartupPath + "\\logs\\";
if (!Directory.Exists(filepath))
{
Directory.CreateDirectory(filepath);
}
File.WriteAllLines(filepath + "AOIResourceLog.txt", lines.ToArray());
Console.WriteLine("结束打印缺少的文字配置");
}
private static string spiltStr = "_";
private static string Text = "Text";
public static string GetIdStr(string className, string controlName, string propertyName)
{
return className + spiltStr + controlName + spiltStr + propertyName;
}
public static string GetIdStr(string className, string propertyName)
{
return className + spiltStr + propertyName;
}
public static string GetTextIdStr(string className, string controlName)
{
return className + spiltStr + controlName + spiltStr + Text;
}
public static string GetTextIdStr(string className)
{
return className + spiltStr + Text;
}
public static string GetValue(string value, params object[] param)
{
return GetString(value, value, param);
}
}
public class MyMessage
{
public static DialogResult Show(string msg, params object[] param)
{
string showMsg = AOIResourceCulture.GetString(msg, msg, param);
return MessageBox.Show(showMsg);
}
public static DialogResult Show(string msg, string title, MessageBoxButtons but, params object[] param)
{
string showMsg = AOIResourceCulture.GetString(msg, msg, param);
string showTitle = AOIResourceCulture.GetString(title, title);
return MessageBox.Show(showMsg, showTitle, but);
}
}
}
......@@ -71,6 +71,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AOIFormUtil.cs" />
<Compile Include="AOIResourceCulture.cs" />
<Compile Include="camera\CameraManager.cs" />
<Compile Include="ControlUtil.cs" />
<Compile Include="control\AioTempMatchControl.cs">
......@@ -110,6 +111,12 @@
<DependentUpon>FrmAoiSetting.cs</DependentUpon>
</Compile>
<Compile Include="camera\HIKCamera.cs" />
<Compile Include="FrmBase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmBase.Designer.cs">
<DependentUpon>FrmBase.cs</DependentUpon>
</Compile>
<Compile Include="FrmMethodName.cs">
<SubType>Form</SubType>
</Compile>
......@@ -136,6 +143,9 @@
<EmbeddedResource Include="FrmAoiSetting.resx">
<DependentUpon>FrmAoiSetting.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmBase.resx">
<DependentUpon>FrmBase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmMethodName.resx">
<DependentUpon>FrmMethodName.cs</DependentUpon>
</EmbeddedResource>
......@@ -149,6 +159,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Content Include="Properties\en-US.resource">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......@@ -158,6 +171,9 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Content Include="Properties\zh-CN.resource">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
......
......@@ -61,18 +61,18 @@ namespace AccAOI
/// <summary>
/// Mark点设置
/// </summary>
public static string Mark = "Mark点设置";
public static string Mark =AOIResourceCulture.GetValue( "Mark点设置");
/// <summary>
/// 斑点分析
/// </summary>
public static string AOIBlob = "斑点分析";
public static string AOIBlob = AOIResourceCulture.GetValue("斑点分析");
/// <summary>
/// 颜色抽取
/// </summary>
public static string AOIRGB = "颜色抽取";
public static string AOIRGB = AOIResourceCulture.GetValue("颜色抽取");
/// <summary>
/// 模板匹配
/// </summary>
public static string Match = "模板匹配";
public static string Match = AOIResourceCulture.GetValue("模板匹配");
}
}
......@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace AccAOI
{
public partial class FrmAoiSetting : Asa.Theme.FlatForm
public partial class FrmAoiSetting : FrmBase
{
private control.ABaseControl aoiControl = null;
public static Image BaseImg = null;
......@@ -41,7 +41,7 @@ namespace AccAOI
Project = AoiProject.Load(programPath, out result);
if (!result.Equals(""))
{
MessageBox.Show("加载项目" + programPath + "失败:\r\n" + result);
MyMessage.Show("加载项目" + programPath + "失败:\r\n" + result);
}
else
{
......@@ -65,15 +65,15 @@ namespace AccAOI
comType.ItemAdd(ControlType.AOIRGB);
comType.ItemAdd(ControlType.Match);
comType.Text = ControlType.Mark;
string defaultImg = "F:\\电路板图片\\照片 2创建于2019年4月19日 11_34_53.jpg";
if (System.IO.File.Exists(defaultImg))
{
//读取图片内容
Image file = (Image)Image.FromFile(defaultImg);
BaseImg = new Bitmap(file);
file.Dispose();
imageBox1.Image = BaseImg;
}
//string defaultImg = "F:\\电路板图片\\照片 2创建于2019年4月19日 11_34_53.jpg";
//if (System.IO.File.Exists(defaultImg))
//{
// //读取图片内容
// Image file = (Image)Image.FromFile(defaultImg);
// BaseImg = new Bitmap(file);
// file.Dispose();
// imageBox1.Image = BaseImg;
//}
foreach (string str in CameraManager.hikNameList)
......@@ -93,7 +93,7 @@ namespace AccAOI
private void btnOpenImage_Click(object sender, EventArgs e)
{
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "打开本地图片";
openDialog.Title =AOIResourceCulture.GetValue( "打开本地图片");
openDialog.Filter = "All Supported Images (*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png)|*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
openDialog.DefaultExt = "png";
......@@ -128,7 +128,7 @@ namespace AccAOI
string camera = cmbCameraList.Text;
if (camera.Equals(""))
{
MessageBox.Show("清先选择相机");
MyMessage.Show("清先选择相机");
return;
} //将图片保存到本地重新加载
// string filePath = Application.StartupPath + @"\aimage\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + DateTime.Now.Millisecond.ToString().PadLeft(3, '0') ;
......@@ -147,7 +147,7 @@ namespace AccAOI
}
else
{
MessageBox.Show("获取图片失败");
MyMessage.Show("获取图片失败");
return;
}
}
......@@ -171,7 +171,7 @@ namespace AccAOI
catch (Exception ex)
{
Console.WriteLine("btnGetCameraImg_Click Error:" + ex.ToString());
MessageBox.Show(ex.ToString());
MyMessage.Show(ex.ToString());
}
}
......@@ -179,7 +179,7 @@ namespace AccAOI
{
if (Project != null)
{
DialogResult dialResult = MessageBox.Show("是否打开新项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
DialogResult dialResult = MyMessage.Show("是否打开新项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dialResult.Equals(DialogResult.Yes))
{
CloseCurrAoi();
......@@ -214,7 +214,7 @@ namespace AccAOI
}
}
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "打开项目";
openDialog.Title = AOIResourceCulture.GetValue("打开项目");
openDialog.Filter = "(*.data)|*.data|(*.*)|*.*";
if (!String.IsNullOrEmpty(DefaultPath))
{
......@@ -233,7 +233,7 @@ namespace AccAOI
Project = AoiProject.Load(fileName, out msg);
if (!msg.Equals(""))
{
MessageBox.Show("加载项目" + fileName + "失败:\r\n" + msg);
MyMessage.Show("加载项目" + fileName + "失败:\r\n{0}", msg);
}
else
{
......@@ -247,12 +247,12 @@ namespace AccAOI
{
if (this.Project == null)
{
MessageBox.Show("没有项目可保存");
MyMessage.Show("没有项目可保存");
return;
}
SaveCurrAoi();
System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
saveFileDialog.Title = "保存项目";
saveFileDialog.Title = AOIResourceCulture.GetValue("保存项目");
saveFileDialog.Filter = "(*.data)|*.data|(*.*)|*.*";
if (!String.IsNullOrEmpty(currProjectFileName))
......@@ -272,14 +272,14 @@ namespace AccAOI
}
string fileName = saveFileDialog.FileName;
Project.Save(fileName);
MessageBox.Show("保存成功");
MyMessage.Show("保存成功");
}
private void btnNewAoi_Click(object sender, EventArgs e)
{
if (BaseImg == null)
{
MessageBox.Show("清先选择基准图片");
MyMessage.Show("清先选择基准图片");
return;
}
if (this.Project == null)
......@@ -288,7 +288,7 @@ namespace AccAOI
}
if (comType.Text.Equals(""))
{
MessageBox.Show("请选择类型");
MyMessage.Show("请选择类型");
comType.Focus();
return;
}
......@@ -297,7 +297,7 @@ namespace AccAOI
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 + "】方法的名称";
frmName.Text = AOIResourceCulture.GetValue("请输入新【{0}】名称",text);
DialogResult result = frmName.ShowDialog();
if (result.Equals(DialogResult.OK))
{
......@@ -312,7 +312,7 @@ namespace AccAOI
Project.methodMap.Add(methodInfo.MethodName, methodInfo);
ShowAoi(methodInfo);
aoiList.ItemAdd(aoiControl.TitleName);
aoiList.ItemAdd(methodInfo.MethodName);
aoiList.SelectedIndex = Project.methodMap.Count - 1;
if (imageBox1.Visible.Equals(false))
{
......@@ -476,7 +476,7 @@ namespace AccAOI
}
if (TestImage == null)
{
MessageBox.Show("请选择测试图片");
MyMessage.Show("请选择测试图片");
return;
}
Image outImage = null;
......@@ -506,7 +506,7 @@ namespace AccAOI
}
if (this.aoiControl != null)
{
DialogResult result = MessageBox.Show("确定删除 " + aoiControl.AoiInfo.MethodName + " ?", "确认提示", MessageBoxButtons.OKCancel);
DialogResult result = MyMessage.Show("确定删除{0} ?", "确认提示", MessageBoxButtons.OKCancel, aoiControl.AoiInfo.MethodName);
if (result.Equals(DialogResult.OK))
{
if (Project.methodMap.ContainsKey(aoiControl.AoiInfo.MethodName))
......@@ -524,16 +524,16 @@ namespace AccAOI
{
testImageBox1.Visible = false;
imageBox1.Visible = true;
btnImageChange.Text = "显示测试图片";
lblCurrImage.Text = "基准图:";
btnImageChange.Text = AOIResourceCulture.GetValue("显示测试图片");
lblCurrImage.Text = AOIResourceCulture.GetValue("基准图:");
lblCurrImage.ForeColor = Color.LawnGreen;
}
else
{
testImageBox1.Visible = true;
imageBox1.Visible = false;
btnImageChange.Text = "显示基准图片";
lblCurrImage.Text = "测试/效果图:";
btnImageChange.Text = AOIResourceCulture.GetValue("显示基准图片");
lblCurrImage.Text = AOIResourceCulture.GetValue("测试/效果图:");
lblCurrImage.ForeColor = Color.Orange;
}
}
......@@ -541,7 +541,7 @@ namespace AccAOI
private void flatButton2_Click(object sender, EventArgs e)
{
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "打开本地图片";
openDialog.Title = AOIResourceCulture.GetValue("打开本地图片");
openDialog.Filter = "All Supported Images (*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png)|*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
openDialog.DefaultExt = "png";
......@@ -578,7 +578,7 @@ namespace AccAOI
string camera = cmbCameraList.Text;
if (camera.Equals(""))
{
MessageBox.Show("清先选择相机");
MyMessage.Show("清先选择相机");
return;
}
......@@ -597,7 +597,7 @@ namespace AccAOI
}
else
{
MessageBox.Show("获取图片失败");
MyMessage.Show("获取图片失败");
return;
}
}
......@@ -627,7 +627,7 @@ namespace AccAOI
List<string> allName = new List<string>(Project.methodMap.Keys);
allName.Remove(oldName);
FrmMethodName frmName = new FrmMethodName(oldName, allName);
frmName.Text = "请输入修改后的名称";
frmName.Text = AOIResourceCulture.GetValue("请输入修改后的名称");
DialogResult result = frmName.ShowDialog();
if (result.Equals(DialogResult.OK))
{
......
namespace AccAOI
{
partial class FrmBase
{
/// <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.SuspendLayout();
//
// FrmBase
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Location = new System.Drawing.Point(0, 0);
this.Name = "FrmBase";
this.Text = "FrmBase";
this.TitleFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.VisibleChanged += new System.EventHandler(this.FrmBase_VisibleChanged);
this.ResumeLayout(false);
}
#endregion
}
}
\ No newline at end of file
using Asa.Theme;
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 FrmBase : Asa.Theme.FlatForm
{
public FrmBase()
{
InitializeComponent();
}
public string CurrLanguage = "";
public string ClassName
{
get
{
return this.GetType().Name;
}
}
public void LanguageProcess()
{
if (CurrLanguage.Equals(AOIResourceCulture.CurrLanguage))
{
return;
}
string className = this.ClassName;
CurrLanguage = AOIResourceCulture.CurrLanguage;
// this.Text = AOIResourceCulture.GetString(AOIResourceCulture.GetTextIdStr(className), this.Text);
foreach (System.Windows.Forms.Control con in this.Controls)
{
ConProcess(con, className);
}
}
private void ConProcess(System.Windows.Forms.Control con, string className)
{
if ( con is FlatLabel || con is FlatButton || con is Label || con is Button)
{
string newStr = AOIResourceCulture.GetString(AOIResourceCulture.GetTextIdStr(className, con.Name), con.Text);
con.Text = newStr;
con.Tag = newStr;
}
else if (con is FlatPanel)
{
string newStr = AOIResourceCulture.GetString(AOIResourceCulture.GetTextIdStr(className, con.Name), con.Text);
FlatPanel pan = (FlatPanel)con;
foreach (System.Windows.Forms.Control pancon in pan.Controls)
{
ConProcess(pancon, className);
}
}
}
public virtual void LanguagePro()
{
}
private void FrmBase_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible.Equals(true))
{
LanguageProcess();
LanguagePro();
}
}
}
}
<?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
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMethodName));
this.txtName = new Asa.Theme.FlatText();
this.btnCancel = new Asa.Theme.FlatButton();
this.btnOk = new Asa.Theme.FlatButton();
......@@ -35,20 +36,23 @@
//
// txtName
//
this.txtName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.txtName.Font = new System.Drawing.Font("宋体", 9F);
this.txtName.Inside = false;
this.txtName.Location = new System.Drawing.Point(63, 60);
this.txtName.Location = new System.Drawing.Point(66, 80);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(174, 30);
this.txtName.Size = new System.Drawing.Size(219, 30);
this.txtName.TabIndex = 0;
//
// btnCancel
//
this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnCancel.Font = new System.Drawing.Font("宋体", 9F);
this.btnCancel.ImageSize = new System.Drawing.Size(0, 0);
this.btnCancel.Inside = false;
this.btnCancel.Location = new System.Drawing.Point(44, 116);
this.btnCancel.Location = new System.Drawing.Point(66, 144);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(80, 30);
this.btnCancel.Size = new System.Drawing.Size(95, 30);
this.btnCancel.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "取消";
......@@ -56,11 +60,13 @@
//
// btnOk
//
this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnOk.Font = new System.Drawing.Font("宋体", 9F);
this.btnOk.ImageSize = new System.Drawing.Size(0, 0);
this.btnOk.Inside = false;
this.btnOk.Location = new System.Drawing.Point(168, 116);
this.btnOk.Location = new System.Drawing.Point(190, 144);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(80, 30);
this.btnOk.Size = new System.Drawing.Size(95, 30);
this.btnOk.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnOk.TabIndex = 2;
this.btnOk.Text = "确定";
......@@ -70,11 +76,11 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 172);
this.ClientSize = new System.Drawing.Size(366, 223);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.txtName);
this.Location = new System.Drawing.Point(0, 0);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Minimized = false;
this.Name = "FrmMethodName";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
......
......@@ -10,7 +10,7 @@ using System.Windows.Forms;
namespace AccAOI
{
public partial class FrmMethodName : Asa.Theme.FlatForm
public partial class FrmMethodName : FrmBase
{
public string MethodName = "";
public List<string> AllNameList = new List<string>();
......@@ -39,7 +39,7 @@ namespace AccAOI
string newName = txtName.Text;
if (AllNameList.Contains(newName))
{
MessageBox.Show("名称【"+newName+"】已存在,请重新输入");
MyMessage.Show("名称【{0}】已存在,请重新输入", newName);
txtName.Focus();
return;
}
......
FrmAoiSetting_Text=AOI
FrmAoiSetting_btnUpdateName_Text=Rename
FrmAoiSetting_lblCurrImage_Text=Standard Image:
FrmAoiSetting_flatButton1_Text=Get test image
FrmAoiSetting_flatButton2_Text=Select test image
FrmAoiSetting_btnImageChange_Text=Switch to test Image
FrmAoiSetting_btnDel_Text=Delete
FrmAoiSetting_btnExcute_Text=Execute
FrmAoiSetting_btnGetCameraImg_Text=Get standard Image
FrmAoiSetting_flatLabel1_Text=The camera list
FrmAoiSetting_btnOpenImage_Text=Select reference picture
FrmAoiSetting_btnNewAoi_Text=New
FrmAoiSetting_btnSavePro_Text=Save the project
FrmAoiSetting_btnOpenPro_Text=Open the project
AioMarkControl_btnClearArea_Text=Clear
AioMarkControl_panResult_Text=result judgment
AioMarkControl_panParam_Text=parameter setting
AioMarkControl_panAreaSet_Text=Locale - rectangle
AioMarkControl_panAreaImage_Text=Regional image
AioMarkControl_panControl_Text=00_MarkPoint set
AoiRgbControl_btnUpdate_Text=Update
AoiRgbControl_flatLabel9_Text=real time data
AoiRgbControl_flatLabel2_Text=MinR:
AoiRgbControl_flatLabel5_Text=~
AoiRgbControl_flatLabel3_Text=Pixels of:
AoiRgbControl_panResult_Text=result judgment
AoiRgbControl_panParam_Text=parameter setting
AoiRgbControl_btnClearArea_Text=Clear
AoiRgbControl_panAreaSet_Text=Locale - rectangle
AoiRgbControl_panAreaImage_Text=Regional image
AoiRgbControl_panControl_Text=01_Color extraction
AioTempMatchControl_btnClearArea_Text=Clear
AioTempMatchControl_panResult_Text=result judgment
AioTempMatchControl_panParam_Text=parameter setting
AioTempMatchControl_panAreaSet_Text=Locale - rectangle
AioTempMatchControl_panAreaImage_Text=Regional image
AioTempMatchControl_panControl_Text=02_template matching
AoiBlobControl_flatLabel7_Text=DataResult:
AoiBlobControl_btnUpdate_Text=Update
AoiBlobControl_flatLabel4_Text=~
AoiBlobControl_flatLabel6_Text=The number of:
AoiBlobControl_flatLabel5_Text=~
AoiBlobControl_flatLabel2_Text=Graphics inversion:
AoiBlobControl_flatLabel3_Text=Area of filter:
AoiBlobControl_lblthresh_Text=100
AoiBlobControl_flatLabel1_Text= Threshold:
AoiBlobControl_panResult_Text=result judgment
AoiBlobControl_panParam_Text=parameter setting
AoiBlobControl_btnClearArea_Text=Clear
AoiBlobControl_panAreaSet_Text=Locale - rectangle
AoiBlobControl_panAreaImage_Text=Regional image
AoiBlobControl_panControl_Text=04_spot analysis
AioMarkControl_btnOpenImage_Text=Open local image
AioMarkControl_btnTest_Text=test result
AioMarkControl_flatLabel3_Text=similarity:
AioMarkControl_flatLabel2_Text=Mark Area X
AioMarkControl_flatLabel1_Text= Search Area:
AioMarkControl_btnImgType_Text=original
AioMarkControl_btnSetArea_Text=ellipse
AoiRgbControl_flatLabel7_Text=MaxB:
AoiRgbControl_flatLabel1_Text=MaxR:
AoiRgbControl_flatLabel6_Text=MinG:
AoiRgbControl_flatLabel4_Text=MaxG:
AoiRgbControl_flatLabel8_Text=MinB:
AoiRgbControl_btnImgType_Text=original
AoiRgbControl_btnSetArea_Text=ellipse
AioTempMatchControl_btnOpenImage_Text=Open local image
AioTempMatchControl_btnTest_Text=test result
AioTempMatchControl_flatLabel3_Text=similarity :
AioTempMatchControl_btnImgType_Text=original
AioTempMatchControl_btnSetArea_Text=ellipse
AoiBlobControl_lblList_Text=Area of a list:
AoiBlobControl_btnImgType_Text=original
AoiBlobControl_btnSetArea_Text=ellipse
Mark点设置=Mark Point Set
斑点分析=Spot analysis
颜色抽取=Color extraction
模板匹配=Template matching
效果图=rendering Image
区域图 - 原图=Area map - original
面积列表:=Area of a list:
编号=number
面积↓=Area↓
X坐标=X
Y坐标=Y
打开本地图片=Open local image
Mark区域无效=Mark Area is invalid
是否打开新项目?=Open a new project?
提示=reminder
打开项目=Open the project
保存项目=Save the project
保存成功=Save success
确定删除{0} ?=Sure to delete {0}?
确认提示=confirmation
请输入修改后的名称=Please enter a modified name
FrmMethodName_btnOk_Text=OK
FrmMethodName_btnCancel_Text=Cancel
请输入新【{0}】名称=Please enter a new [{0}] name
显示基准图片=Display standard image
测试/效果图:=Testing/rendering Image:
显示测试图片=Switch to test image
基准图:=Standard Image:
原图=original
区域图像 - 效果图=Area image - renderings
区域设置 - 椭圆=Locale - ellipse
矩形=rectangle
区域设置 - 矩形=Locale - rectangle
椭圆=ellipse
参数设置=parameter setting
结果判断=result judgment
\ No newline at end of file
FrmAoiSetting_Text=AOI
FrmAoiSetting_btnUpdateName_Text=修改
FrmAoiSetting_lblCurrImage_Text=基准图:
FrmAoiSetting_flatButton1_Text=获取测试图片
FrmAoiSetting_flatButton2_Text=选择测试图片
FrmAoiSetting_btnImageChange_Text=切换为测试图片
FrmAoiSetting_btnDel_Text=删除
FrmAoiSetting_btnExcute_Text=执行
FrmAoiSetting_btnGetCameraImg_Text=获取基准图片
FrmAoiSetting_flatLabel1_Text=相机列表
FrmAoiSetting_btnOpenImage_Text=选择基准图片
FrmAoiSetting_btnNewAoi_Text=新增
FrmAoiSetting_btnSavePro_Text=保存项目
FrmAoiSetting_btnOpenPro_Text=打开项目
AioMarkControl_btnClearArea_Text=清除
AioMarkControl_panResult_Text=结果判断
AioMarkControl_panParam_Text=参数设置
AioMarkControl_panAreaSet_Text=区域设置-矩形
AioMarkControl_panAreaImage_Text=区域图片
AioMarkControl_panControl_Text=00_Mark点设置
AoiRgbControl_btnUpdate_Text=更新
AoiRgbControl_flatLabel9_Text=像素实时占比:
AoiRgbControl_flatLabel2_Text=MinR:
AoiRgbControl_flatLabel5_Text=~
AoiRgbControl_flatLabel3_Text=像素占比:
AoiRgbControl_panResult_Text=结果判断
AoiRgbControl_panParam_Text=参数设置
AoiRgbControl_btnClearArea_Text=清除
AoiRgbControl_panAreaSet_Text=区域设置-矩形
AoiRgbControl_panAreaImage_Text=区域图片
AoiRgbControl_panControl_Text=01_颜色抽取
AioTempMatchControl_btnClearArea_Text=清除
AioTempMatchControl_panResult_Text=结果判断
AioTempMatchControl_panParam_Text=参数设置
AioTempMatchControl_panAreaSet_Text=区域设置-矩形
AioTempMatchControl_panAreaImage_Text=区域图片
AioTempMatchControl_panControl_Text=02_模板匹配
AoiBlobControl_flatLabel7_Text=数量判断结果:
AoiBlobControl_btnUpdate_Text=更新
AoiBlobControl_flatLabel4_Text=~
AoiBlobControl_flatLabel6_Text=数量判断:
AoiBlobControl_flatLabel5_Text=~
AoiBlobControl_flatLabel2_Text=图形反转:
AoiBlobControl_flatLabel3_Text=面积过滤:
AoiBlobControl_lblthresh_Text=100
AoiBlobControl_flatLabel1_Text=阈值:
AoiBlobControl_panResult_Text=结果判断
AoiBlobControl_panParam_Text=参数设置
AoiBlobControl_btnClearArea_Text=清除
AoiBlobControl_panAreaSet_Text=区域设置-矩形
AoiBlobControl_panAreaImage_Text=区域图片
AoiBlobControl_panControl_Text=04_斑点分析
AioMarkControl_btnOpenImage_Text=打开本地图片
AioMarkControl_btnTest_Text=测试结果
AioMarkControl_flatLabel3_Text=相似度:
AioMarkControl_flatLabel2_Text=Mark区域x
AioMarkControl_flatLabel1_Text=搜索区域:
AioMarkControl_btnImgType_Text=原图
AioMarkControl_btnSetArea_Text=椭圆
AoiRgbControl_flatLabel7_Text=MaxB:
AoiRgbControl_flatLabel1_Text=MaxR:
AoiRgbControl_flatLabel6_Text=MinG:
AoiRgbControl_flatLabel4_Text=MaxG:
AoiRgbControl_flatLabel8_Text=MinB:
AoiRgbControl_btnImgType_Text=原图
AoiRgbControl_btnSetArea_Text=椭圆
AioTempMatchControl_btnOpenImage_Text=打开本地图片
AioTempMatchControl_btnTest_Text=测试结果
AioTempMatchControl_flatLabel3_Text=相似度:
AioTempMatchControl_btnImgType_Text=原图
AioTempMatchControl_btnSetArea_Text=椭圆
AoiBlobControl_lblList_Text=面积列表:
AoiBlobControl_btnImgType_Text=原图
AoiBlobControl_btnSetArea_Text=椭圆
Mark点设置=Mark点设置
斑点分析=斑点分析
颜色抽取=颜色抽取
模板匹配=模板匹配
效果图=效果图
区域图 - 原图=区域图 - 原图
面积列表:=面积列表:
编号=编号
面积↓=面积↓
X坐标=X坐标
Y坐标=Y坐标
打开本地图片=打开本地图片
Mark区域无效=Mark区域无效
是否打开新项目?=是否打开新项目?
提示=提示
打开项目=打开项目
保存项目=保存项目
保存成功=保存成功
确定删除{0} ?=确定删除{0} ?
确认提示=确认提示
请输入修改后的名称=请输入修改后的名称
FrmMethodName_btnOk_Text=确定
FrmMethodName_btnCancel_Text=取消
请输入新【{0}】名称=请输入新【{0}】名称
显示基准图片=显示基准图片
测试/效果图:=测试/效果图:
显示测试图片=显示测试图片
基准图:=基准图:
原图=原图
区域图像 - 效果图=区域图像 - 效果图
区域设置 - 椭圆=区域设置 - 椭圆
矩形=矩形
区域设置 - 矩形=区域设置 - 矩形
椭圆=椭圆
参数设置=参数设置
结果判断=结果判断
\ No newline at end of file
此文件类型无法预览
......@@ -50,9 +50,9 @@ namespace AccAOI.control
this.btnSetArea.Font = new System.Drawing.Font("宋体", 9F);
this.btnSetArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnSetArea.Inside = false;
this.btnSetArea.Location = new System.Drawing.Point(104, 30);
this.btnSetArea.Location = new System.Drawing.Point(124, 30);
this.btnSetArea.Name = "btnSetArea";
this.btnSetArea.Size = new System.Drawing.Size(90, 30);
this.btnSetArea.Size = new System.Drawing.Size(83, 30);
this.btnSetArea.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnSetArea.TabIndex = 7;
this.btnSetArea.Text = "椭圆";
......@@ -64,9 +64,9 @@ namespace AccAOI.control
this.btnClearArea.Font = new System.Drawing.Font("宋体", 9F);
this.btnClearArea.ImageSize = new System.Drawing.Size(0, 0);
this.btnClearArea.Inside = false;
this.btnClearArea.Location = new System.Drawing.Point(204, 274);
this.btnClearArea.Location = new System.Drawing.Point(212, 274);
this.btnClearArea.Name = "btnClearArea";
this.btnClearArea.Size = new System.Drawing.Size(90, 30);
this.btnClearArea.Size = new System.Drawing.Size(83, 30);
this.btnClearArea.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnClearArea.TabIndex = 6;
this.btnClearArea.Text = "清除";
......@@ -117,9 +117,9 @@ namespace AccAOI.control
this.btnImgType.Font = new System.Drawing.Font("宋体", 9F);
this.btnImgType.ImageSize = new System.Drawing.Size(0, 0);
this.btnImgType.Inside = false;
this.btnImgType.Location = new System.Drawing.Point(9, 30);
this.btnImgType.Location = new System.Drawing.Point(6, 30);
this.btnImgType.Name = "btnImgType";
this.btnImgType.Size = new System.Drawing.Size(90, 30);
this.btnImgType.Size = new System.Drawing.Size(115, 30);
this.btnImgType.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnImgType.TabIndex = 8;
this.btnImgType.Text = "原图";
......@@ -175,6 +175,8 @@ namespace AccAOI.control
this.Controls.Add(this.panControl);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "ABaseControl";
this.Load += new System.EventHandler(this.ABaseControl_Load);
this.VisibleChanged += new System.EventHandler(this.ABaseControl_VisibleChanged);
this.panAreaSet.ResumeLayout(false);
this.ResumeLayout(false);
......
......@@ -10,6 +10,7 @@ using System.Windows.Forms;
using AOI;
using System.Drawing.Drawing2D;
using Acc.ImageBox;
using Asa.Theme;
namespace AccAOI.control
{
......@@ -17,7 +18,7 @@ namespace AccAOI.control
{
public ABaseControl()
{
InitializeComponent();
InitializeComponent();
}
public string TitleName
{
......@@ -27,7 +28,7 @@ namespace AccAOI.control
protected object UpdateLock = "";
public Image GetImg()
{
return FrmAoiSetting.BaseImg;
return FrmAoiSetting.BaseImg;
}
internal bool IsShowOk = false;
/// <summary>
......@@ -43,8 +44,8 @@ namespace AccAOI.control
/// 区域信息
/// </summary>
protected GraphicsPath currPath = null;
public AccImageBox BImageBox;
public AccImageBox BImageBox;
public AoiMethod AoiInfo;
/// <summary>
/// 未处理的小图
......@@ -78,39 +79,40 @@ namespace AccAOI.control
if (AreaType.Equals(1))
{
AreaType = 2;
panAreaSet.Text = "区域设置 - 椭圆";
btnSetArea.Text = "矩形";
panAreaSet.Text = AOIResourceCulture.GetValue("区域设置 - 椭圆");
btnSetArea.Text = AOIResourceCulture.GetValue("矩形");
BImageBox.SelectionMode = ImageBoxSelectionMode.Eclipse;
}
else
{
AreaType = 1;
panAreaSet.Text = "区域设置 - 矩形";
btnSetArea.Text = "椭圆";
panAreaSet.Text = AOIResourceCulture.GetValue("区域设置 - 矩形");
btnSetArea.Text = AOIResourceCulture.GetValue("椭圆");
BImageBox.SelectionMode = ImageBoxSelectionMode.Rectangle;
}
}
private void btnClearArea_Click(object sender, EventArgs e)
{
// this.BImageBox.CleearArea();
// this.BImageBox.CleearArea();
this.aoiImage.Image = null;
BImageBox.SelectNone();
}
private void btnImgType_Click(object sender, EventArgs e)
private void btnImgType_Click(object sender, EventArgs e)
{
if (btnImgType.Text.Equals("原图")) {
if (ShowImageType.Equals(2))
{
ShowImageType = 1;
btnImgType.Text = "效果图";
panAreaImage.Text = "区域图 - 原图";
btnImgType.Text = AOIResourceCulture.GetValue("效果图");
panAreaImage.Text = AOIResourceCulture.GetValue("区域图 - 原图");
}
else
{
ShowImageType = 2;
btnImgType.Text = "原图";
panAreaImage.Text = "区域图像 - 效果图";
btnImgType.Text = AOIResourceCulture.GetValue("原图");
panAreaImage.Text = AOIResourceCulture.GetValue("区域图像 - 效果图");
}
UpdateImage();
}
......@@ -127,16 +129,91 @@ namespace AccAOI.control
if (type.Equals(1))
{
ShowImageType = 1;
btnImgType.Text = "效果图";
panAreaImage.Text = "区域图 - 原图";
btnImgType.Text = AOIResourceCulture.GetValue("效果图");
panAreaImage.Text = AOIResourceCulture.GetValue("区域图 - 原图");
}
else
{
ShowImageType = 2;
btnImgType.Text = "原图";
panAreaImage.Text = "区域图像 - 效果图";
btnImgType.Text = AOIResourceCulture.GetValue("原图");
panAreaImage.Text = AOIResourceCulture.GetValue("区域图像 - 效果图");
}
}
public string CurrLanguage = "";
public string ClassName
{
get
{
return this.GetType().Name;
}
}
public void LanguageProcess()
{
if (CurrLanguage.Equals(AOIResourceCulture.CurrLanguage))
{
return;
}
string className = this.ClassName;
CurrLanguage = AOIResourceCulture.CurrLanguage;
this.Text = AOIResourceCulture.GetString(AOIResourceCulture.GetTextIdStr(className), this.Text);
foreach (System.Windows.Forms.Control con in this.Controls)
{
ConProcess(con, className);
}
}
private void ConProcess(System.Windows.Forms.Control con, string className)
{
if (con is FlatLabel || con is FlatButton || con is Label || con is Button)
{
string newStr = AOIResourceCulture.GetString(AOIResourceCulture.GetTextIdStr(className, con.Name), con.Text);
con.Text = newStr;
con.Tag = newStr;
}
else if (con is FlatPanel)
{
string newStr = AOIResourceCulture.GetString(AOIResourceCulture.GetTextIdStr(className, con.Name), con.Text);
FlatPanel pan = (FlatPanel)con;
foreach (System.Windows.Forms.Control pancon in pan.Controls)
{
ConProcess(pancon, className);
}
}
}
private void ABaseControl_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible.Equals(true))
{
LanguageProcess();
}
}
public virtual void LanguagePro()
{
panAreaSet.Text = AOIResourceCulture.GetValue("区域设置 - 矩形");
btnSetArea.Text = AOIResourceCulture.GetValue("椭圆");
BImageBox.SelectionMode = ImageBoxSelectionMode.Rectangle;
ShowImageType = 2;
btnImgType.Text = AOIResourceCulture.GetValue("原图");
panAreaImage.Text = AOIResourceCulture.GetValue("区域图像 - 效果图");
panParam.Text = AOIResourceCulture.GetValue("参数设置");
panResult.Text = AOIResourceCulture.GetValue("结果判断");
}
private void ABaseControl_Load(object sender, EventArgs e)
{
LanguagePro();
}
}
}
......@@ -63,30 +63,35 @@
//
// flatLabel1
//
this.flatLabel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatLabel1.Font = new System.Drawing.Font("宋体", 9F);
this.flatLabel1.Inside = false;
this.flatLabel1.Location = new System.Drawing.Point(14, 90);
this.flatLabel1.Location = new System.Drawing.Point(5, 90);
this.flatLabel1.Name = "flatLabel1";
this.flatLabel1.Size = new System.Drawing.Size(68, 30);
this.flatLabel1.Size = new System.Drawing.Size(98, 30);
this.flatLabel1.TabIndex = 0;
this.flatLabel1.Text = "搜索区域:";
this.flatLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// flatTextSearchZoom
//
this.flatTextSearchZoom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatTextSearchZoom.Font = new System.Drawing.Font("宋体", 9F);
this.flatTextSearchZoom.Inside = false;
this.flatTextSearchZoom.Location = new System.Drawing.Point(175, 90);
this.flatTextSearchZoom.Location = new System.Drawing.Point(208, 91);
this.flatTextSearchZoom.Name = "flatTextSearchZoom";
this.flatTextSearchZoom.Size = new System.Drawing.Size(95, 30);
this.flatTextSearchZoom.Size = new System.Drawing.Size(55, 30);
this.flatTextSearchZoom.TabIndex = 1;
this.flatTextSearchZoom.Text = "2";
//
// flatLabel2
//
this.flatLabel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatLabel2.Font = new System.Drawing.Font("宋体", 9F);
this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(109, 90);
this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(65, 30);
this.flatLabel2.Size = new System.Drawing.Size(93, 30);
this.flatLabel2.TabIndex = 2;
this.flatLabel2.Text = "Mark区域x";
//
......@@ -103,11 +108,13 @@
//
// btnTest
//
this.btnTest.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnTest.Font = new System.Drawing.Font("宋体", 9F);
this.btnTest.ImageSize = new System.Drawing.Size(0, 0);
this.btnTest.Inside = false;
this.btnTest.Location = new System.Drawing.Point(141, 79);
this.btnTest.Location = new System.Drawing.Point(145, 79);
this.btnTest.Name = "btnTest";
this.btnTest.Size = new System.Drawing.Size(90, 30);
this.btnTest.Size = new System.Drawing.Size(115, 30);
this.btnTest.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnTest.TabIndex = 5;
this.btnTest.Text = "测试结果";
......@@ -115,11 +122,13 @@
//
// btnOpenImage
//
this.btnOpenImage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnOpenImage.Font = new System.Drawing.Font("宋体", 9F);
this.btnOpenImage.ImageSize = new System.Drawing.Size(0, 0);
this.btnOpenImage.Inside = false;
this.btnOpenImage.Location = new System.Drawing.Point(45, 79);
this.btnOpenImage.Location = new System.Drawing.Point(24, 79);
this.btnOpenImage.Name = "btnOpenImage";
this.btnOpenImage.Size = new System.Drawing.Size(90, 30);
this.btnOpenImage.Size = new System.Drawing.Size(115, 30);
this.btnOpenImage.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnOpenImage.TabIndex = 6;
this.btnOpenImage.Text = "打开本地图片";
......@@ -127,6 +136,7 @@
//
// txtImage
//
this.txtImage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.txtImage.Font = new System.Drawing.Font("宋体", 9F);
this.txtImage.Inside = false;
this.txtImage.Location = new System.Drawing.Point(8, 33);
......@@ -159,19 +169,22 @@
//
// flatLabel3
//
this.flatLabel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatLabel3.Font = new System.Drawing.Font("宋体", 9F);
this.flatLabel3.Inside = false;
this.flatLabel3.Location = new System.Drawing.Point(14, 37);
this.flatLabel3.Location = new System.Drawing.Point(5, 37);
this.flatLabel3.Name = "flatLabel3";
this.flatLabel3.Size = new System.Drawing.Size(55, 30);
this.flatLabel3.Size = new System.Drawing.Size(74, 30);
this.flatLabel3.TabIndex = 11;
this.flatLabel3.Text = "相似度:";
this.flatLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtSamePercent
//
this.txtSamePercent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.txtSamePercent.Font = new System.Drawing.Font("宋体", 9F);
this.txtSamePercent.Inside = false;
this.txtSamePercent.Location = new System.Drawing.Point(75, 37);
this.txtSamePercent.Location = new System.Drawing.Point(81, 37);
this.txtSamePercent.Name = "txtSamePercent";
this.txtSamePercent.Padding = new System.Windows.Forms.Padding(3);
this.txtSamePercent.Size = new System.Drawing.Size(41, 30);
......
......@@ -82,7 +82,7 @@ namespace AccAOI.control
{
this.aoiImage.Image = null;
lblResult.ForeColor = Color.Red ;
lblResult.Text = "Mark区域无效";
lblResult.Text =AOIResourceCulture.GetValue( "Mark区域无效");
}
else
{
......@@ -91,7 +91,7 @@ namespace AccAOI.control
lblResult.Text = "OK" ;
this.aoiImage.Image = result;
}
lblTime.Text= "耗时:" + Math.Round(span.TotalSeconds, 1)+ "秒";
lblTime.Text= "times :" + Math.Round(span.TotalSeconds, 1)+ "s";
}
}
......@@ -150,7 +150,7 @@ namespace AccAOI.control
private void btnOpenImage_Click(object sender, EventArgs e)
{
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "打开本地图片";
openDialog.Title = AOIResourceCulture.GetValue("打开本地图片");
openDialog.Filter = "All Supported Images (*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png)|*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
openDialog.DefaultExt = "png";
//openDialog.DefaultExt = "png";
......
......@@ -68,11 +68,13 @@
//
// btnTest
//
this.btnTest.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnTest.Font = new System.Drawing.Font("宋体", 9F);
this.btnTest.ImageSize = new System.Drawing.Size(0, 0);
this.btnTest.Inside = false;
this.btnTest.Location = new System.Drawing.Point(141, 79);
this.btnTest.Location = new System.Drawing.Point(145, 79);
this.btnTest.Name = "btnTest";
this.btnTest.Size = new System.Drawing.Size(90, 30);
this.btnTest.Size = new System.Drawing.Size(115, 30);
this.btnTest.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnTest.TabIndex = 5;
this.btnTest.Text = "测试结果";
......@@ -80,11 +82,13 @@
//
// btnOpenImage
//
this.btnOpenImage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnOpenImage.Font = new System.Drawing.Font("宋体", 9F);
this.btnOpenImage.ImageSize = new System.Drawing.Size(0, 0);
this.btnOpenImage.Inside = false;
this.btnOpenImage.Location = new System.Drawing.Point(45, 79);
this.btnOpenImage.Location = new System.Drawing.Point(24, 79);
this.btnOpenImage.Name = "btnOpenImage";
this.btnOpenImage.Size = new System.Drawing.Size(90, 30);
this.btnOpenImage.Size = new System.Drawing.Size(115, 30);
this.btnOpenImage.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnOpenImage.TabIndex = 6;
this.btnOpenImage.Text = "打开本地图片";
......@@ -92,6 +96,7 @@
//
// txtImage
//
this.txtImage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.txtImage.Font = new System.Drawing.Font("宋体", 9F);
this.txtImage.Inside = false;
this.txtImage.Location = new System.Drawing.Point(8, 33);
......@@ -124,19 +129,22 @@
//
// flatLabel3
//
this.flatLabel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.flatLabel3.Font = new System.Drawing.Font("宋体", 9F);
this.flatLabel3.Inside = false;
this.flatLabel3.Location = new System.Drawing.Point(14, 37);
this.flatLabel3.Location = new System.Drawing.Point(6, 37);
this.flatLabel3.Name = "flatLabel3";
this.flatLabel3.Size = new System.Drawing.Size(55, 30);
this.flatLabel3.Size = new System.Drawing.Size(70, 30);
this.flatLabel3.TabIndex = 11;
this.flatLabel3.Text = "相似度:";
this.flatLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtSamePercent
//
this.txtSamePercent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.txtSamePercent.Font = new System.Drawing.Font("宋体", 9F);
this.txtSamePercent.Inside = false;
this.txtSamePercent.Location = new System.Drawing.Point(75, 37);
this.txtSamePercent.Location = new System.Drawing.Point(82, 37);
this.txtSamePercent.Name = "txtSamePercent";
this.txtSamePercent.Padding = new System.Windows.Forms.Padding(3);
this.txtSamePercent.Size = new System.Drawing.Size(41, 30);
......
......@@ -80,7 +80,7 @@ namespace AccAOI.control
{
this.aoiImage.Image = null;
lblResult.ForeColor = Color.Red ;
lblResult.Text = "匹配失败";
lblResult.Text = AOIResourceCulture.GetValue("匹配失败");
}
else
{
......@@ -92,7 +92,7 @@ namespace AccAOI.control
this.aoiImage.Image = result.currentRoiImage;
}
}
lblTime.Text= "耗时:" + Math.Round(span.TotalSeconds, 1)+ "秒";
lblTime.Text= "times :" + Math.Round(span.TotalSeconds, 1)+ "s";
}
}
......@@ -150,7 +150,7 @@ namespace AccAOI.control
private void btnOpenImage_Click(object sender, EventArgs e)
{
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "打开本地图片";
openDialog.Title = AOIResourceCulture.GetValue("打开本地图片");
openDialog.Filter = "All Supported Images (*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png)|*.bmp;*.dib;*.rle;*.gif;*.jpg;*.png|Bitmaps (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|Graphics Interchange Format (*.gif)|*.gif|Joint Photographic Experts (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All Files (*.*)|*.*";
openDialog.DefaultExt = "png";
//openDialog.DefaultExt = "png";
......
......@@ -89,7 +89,7 @@ namespace AccAOI.control
{
try
{
lblList.Text = "面积列表:";
lblList.Text = AOIResourceCulture.GetValue("面积列表:");
Image BaseImage = GetImg();
if (BaseImage == null || currPath == null)
{
......@@ -114,7 +114,8 @@ namespace AccAOI.control
}
}
list = (from m in list orderby m.Area descending select m).ToList< CvBlob > ();
string text= "编号".PadLeft(5,' ') + "面积↓".PadLeft(8, ' ') + "X坐标".PadLeft(10, ' ') + "Y坐标".PadLeft(10, ' ');
string text= AOIResourceCulture.GetValue("编号").PadLeft(5,' ') + AOIResourceCulture.GetValue("面积↓").PadLeft(8, ' ') + AOIResourceCulture.GetValue("X坐标").PadLeft(10, ' ') +
AOIResourceCulture.GetValue("Y坐标").PadLeft(10, ' ');
int index = 1;
foreach (CvBlob cv in list)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!