Commit 469cabf7 几米阳光

1

1 个父辈 14393650
...@@ -18,13 +18,22 @@ namespace CodeLibrary ...@@ -18,13 +18,22 @@ namespace CodeLibrary
public static string China = "zh-CN"; public static string China = "zh-CN";
public static string English = "en-US"; public static string English = "en-US";
private static Dictionary<string, string> chineseMap = new Dictionary<string, string>(); private static Dictionary<string, string> chineseMap = new Dictionary<string, string>();
internal static string GetString(object selCamera, string v)
{
throw new NotImplementedException();
}
private static Dictionary<string, string> englishMap = new Dictionary<string, string>(); private static Dictionary<string, string> englishMap = new Dictionary<string, string>();
public delegate string GetLanguageDelegate(); public delegate string GetLanguageDelegate();
public static event GetLanguageDelegate GetLanguageEvent; public static event GetLanguageDelegate GetLanguageEvent;
public static string GetLanguage() public static string GetLanguage()
{ {
return English; if (GetLanguageEvent == null)
{
return China;
}
string result = GetLanguageEvent?.Invoke(); string result = GetLanguageEvent?.Invoke();
if (result == null) if (result == null)
{ {
...@@ -126,6 +135,27 @@ namespace CodeLibrary ...@@ -126,6 +135,27 @@ namespace CodeLibrary
HDLogUtil.error("CodeResourceControl" + ex.ToString()); HDLogUtil.error("CodeResourceControl" + ex.ToString());
} }
} }
/// <summary>
/// 请先选择相机
/// </summary>
public static string selCamera = "selCamera";
/// <summary>
/// 请先选择图片
/// </summary>
public static string selImage = "selImage";
/// <summary>
/// 提示
/// </summary>
public static string title = "title";
/// <summary>
/// 获取二维码图片为空
/// </summary>
public static string imageIsNull = "imageIsNull";
/// <summary>
/// 确定删除文件:
/// </summary>
public static string sureDelete = "sureDelete";
} }
......
...@@ -27,7 +27,11 @@ namespace CodeLibrary ...@@ -27,7 +27,11 @@ namespace CodeLibrary
{ {
InitializeComponent(); InitializeComponent();
} }
private string selCamera = CodeResourceControl.GetString(CodeResourceControl.selCamera, "请先选择相机");
private string selImage = CodeResourceControl.GetString(CodeResourceControl.selImage, "请先选择图片");
private string title = CodeResourceControl.GetString(CodeResourceControl.title, "提示");
private string imageIsNull = CodeResourceControl.GetString(CodeResourceControl.imageIsNull, "获取二维码图片为空");
private string sureDelete = CodeResourceControl.GetString(CodeResourceControl.sureDelete, "确定删除文件:");
private void FrmMain_Load(object sender, EventArgs e) private void FrmMain_Load(object sender, EventArgs e)
{ {
...@@ -69,8 +73,8 @@ namespace CodeLibrary ...@@ -69,8 +73,8 @@ namespace CodeLibrary
private void btnSelImage_Click(object sender, EventArgs e) private void btnSelImage_Click(object sender, EventArgs e)
{ {
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog(); System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "选择二维码图片"; openDialog.Title = selImage;
openDialog.Filter = "图片(*.jpg)|*.jpg|图片(*.png)|*.png|图片(*.bmp)|*.bmp"; openDialog.Filter = "(*.jpg)|*.jpg|(*.png)|*.png|(*.bmp)|*.bmp";
//openDialog.DefaultExt = "png"; //openDialog.DefaultExt = "png";
System.Windows.Forms.DialogResult result = openDialog.ShowDialog(); System.Windows.Forms.DialogResult result = openDialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.Cancel) if (result == System.Windows.Forms.DialogResult.Cancel)
...@@ -81,7 +85,7 @@ namespace CodeLibrary ...@@ -81,7 +85,7 @@ namespace CodeLibrary
string filename = txtPath.Text; string filename = txtPath.Text;
if (string.IsNullOrEmpty(filename)) if (string.IsNullOrEmpty(filename))
{ {
MessageBox.Show("获取二维码图片为空"); MessageBox.Show(imageIsNull);
} }
pictureBox1.Image = null; pictureBox1.Image = null;
//读取图片内容 //读取图片内容
...@@ -93,7 +97,7 @@ namespace CodeLibrary ...@@ -93,7 +97,7 @@ namespace CodeLibrary
{ {
if (pictureBox1.Image == null || txtPath.Text.Equals("")) if (pictureBox1.Image == null || txtPath.Text.Equals(""))
{ {
MessageBox.Show("请先选择图片","提示",MessageBoxButtons.OK,MessageBoxIcon.Error); MessageBox.Show(selImage,title,MessageBoxButtons.OK,MessageBoxIcon.Error);
return; return;
} }
Bitmap map = new Bitmap(pictureBox1.Image); Bitmap map = new Bitmap(pictureBox1.Image);
...@@ -104,7 +108,7 @@ namespace CodeLibrary ...@@ -104,7 +108,7 @@ namespace CodeLibrary
{ {
if (pictureBox1.Image == null || txtPath.Text.Equals("")) if (pictureBox1.Image == null || txtPath.Text.Equals(""))
{ {
MessageBox.Show("请先选择图片", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selImage ,title, MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
Bitmap map = new Bitmap(pictureBox1.Image); Bitmap map = new Bitmap(pictureBox1.Image);
...@@ -117,7 +121,7 @@ namespace CodeLibrary ...@@ -117,7 +121,7 @@ namespace CodeLibrary
{ {
if (list.Count > 0) if (list.Count > 0)
{ {
txtResult.Text += "\r\n识别到二维码:"; txtResult.Text += "\r\n code list:";
foreach (CodeInfo code in list) foreach (CodeInfo code in list)
{ {
txtResult.Text += "\r\n" + ""+code.CodeType+" (X:" + code.X + ",Y:" + code.Y + ") " + code.CodeStr; txtResult.Text += "\r\n" + ""+code.CodeType+" (X:" + code.X + ",Y:" + code.Y + ") " + code.CodeStr;
...@@ -125,7 +129,7 @@ namespace CodeLibrary ...@@ -125,7 +129,7 @@ namespace CodeLibrary
} }
else else
{ {
txtResult.Text += "\r\n未识别到二维码"; txtResult.Text += "\r\n no code ";
} }
} }
...@@ -133,7 +137,7 @@ namespace CodeLibrary ...@@ -133,7 +137,7 @@ namespace CodeLibrary
{ {
if (pictureBox1.Image == null ) if (pictureBox1.Image == null )
{ {
MessageBox.Show("请先选择图片", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selImage ,title, MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
int count = cmbCount.SelectedIndex + 1; int count = cmbCount.SelectedIndex + 1;
...@@ -166,7 +170,7 @@ namespace CodeLibrary ...@@ -166,7 +170,7 @@ namespace CodeLibrary
{ {
if (pictureBox1.Image == null) if (pictureBox1.Image == null)
{ {
MessageBox.Show("请先选择图片", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selImage ,title, MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
int count = cmbCount.SelectedIndex + 1; int count = cmbCount.SelectedIndex + 1;
...@@ -211,7 +215,7 @@ namespace CodeLibrary ...@@ -211,7 +215,7 @@ namespace CodeLibrary
string camerName = cmbCamera.Text; string camerName = cmbCamera.Text;
if (index < 0) if (index < 0)
{ {
MessageBox.Show("请先选择相机"); MessageBox.Show(selCamera);
return null; return null;
} }
if (baslerNameList.Contains(camerName)) if (baslerNameList.Contains(camerName))
...@@ -253,7 +257,7 @@ namespace CodeLibrary ...@@ -253,7 +257,7 @@ namespace CodeLibrary
{ {
if (pictureBox1.Image == null || txtPath.Text.Equals("")) if (pictureBox1.Image == null || txtPath.Text.Equals(""))
{ {
MessageBox.Show("请先选择图片", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selImage ,title, MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
Bitmap map = new Bitmap(pictureBox1.Image); Bitmap map = new Bitmap(pictureBox1.Image);
...@@ -265,7 +269,7 @@ namespace CodeLibrary ...@@ -265,7 +269,7 @@ namespace CodeLibrary
{ {
if (pictureBox1.Image == null || txtPath.Text.Equals("")) if (pictureBox1.Image == null || txtPath.Text.Equals(""))
{ {
MessageBox.Show("请先选择图片", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selImage ,title, MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
Bitmap map = new Bitmap(pictureBox1.Image); Bitmap map = new Bitmap(pictureBox1.Image);
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
// btnStop // btnStop
// //
this.btnStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnStop.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStop.Location = new System.Drawing.Point(949, 51); this.btnStop.Location = new System.Drawing.Point(949, 51);
this.btnStop.Name = "btnStop"; this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(144, 35); this.btnStop.Size = new System.Drawing.Size(144, 35);
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
// btnOpen // btnOpen
// //
this.btnOpen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnOpen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnOpen.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnOpen.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpen.Location = new System.Drawing.Point(949, 13); this.btnOpen.Location = new System.Drawing.Point(949, 13);
this.btnOpen.Name = "btnOpen"; this.btnOpen.Name = "btnOpen";
this.btnOpen.Size = new System.Drawing.Size(144, 35); this.btnOpen.Size = new System.Drawing.Size(144, 35);
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
// btnExit // btnExit
// //
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.Location = new System.Drawing.Point(1096, 51); this.btnExit.Location = new System.Drawing.Point(1096, 51);
this.btnExit.Name = "btnExit"; this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(110, 35); this.btnExit.Size = new System.Drawing.Size(110, 35);
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
// //
// label1 // label1
// //
this.label1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 19); this.label1.Location = new System.Drawing.Point(3, 19);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(110, 20); this.label1.Size = new System.Drawing.Size(110, 20);
...@@ -125,28 +125,28 @@ ...@@ -125,28 +125,28 @@
// cmbHalconCamera // cmbHalconCamera
// //
this.cmbHalconCamera.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbHalconCamera.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbHalconCamera.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbHalconCamera.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbHalconCamera.FormattingEnabled = true; this.cmbHalconCamera.FormattingEnabled = true;
this.cmbHalconCamera.Location = new System.Drawing.Point(131, 16); this.cmbHalconCamera.Location = new System.Drawing.Point(131, 16);
this.cmbHalconCamera.Name = "cmbHalconCamera"; this.cmbHalconCamera.Name = "cmbHalconCamera";
this.cmbHalconCamera.Size = new System.Drawing.Size(186, 28); this.cmbHalconCamera.Size = new System.Drawing.Size(186, 25);
this.cmbHalconCamera.TabIndex = 8; this.cmbHalconCamera.TabIndex = 8;
this.cmbHalconCamera.Visible = false; this.cmbHalconCamera.Visible = false;
// //
// cmbCodeType // cmbCodeType
// //
this.cmbCodeType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCodeType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCodeType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbCodeType.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbCodeType.FormattingEnabled = true; this.cmbCodeType.FormattingEnabled = true;
this.cmbCodeType.Location = new System.Drawing.Point(131, 53); this.cmbCodeType.Location = new System.Drawing.Point(131, 53);
this.cmbCodeType.Name = "cmbCodeType"; this.cmbCodeType.Name = "cmbCodeType";
this.cmbCodeType.Size = new System.Drawing.Size(186, 28); this.cmbCodeType.Size = new System.Drawing.Size(186, 25);
this.cmbCodeType.TabIndex = 10; this.cmbCodeType.TabIndex = 10;
this.cmbCodeType.SelectedIndexChanged += new System.EventHandler(this.cmbCodeType_SelectedIndexChanged); this.cmbCodeType.SelectedIndexChanged += new System.EventHandler(this.cmbCodeType_SelectedIndexChanged);
// //
// label2 // label2
// //
this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 57); this.label2.Location = new System.Drawing.Point(3, 57);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(110, 20); this.label2.Size = new System.Drawing.Size(110, 20);
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
// //
// lblCount // lblCount
// //
this.lblCount.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblCount.Location = new System.Drawing.Point(323, 58); this.lblCount.Location = new System.Drawing.Point(323, 58);
this.lblCount.Name = "lblCount"; this.lblCount.Name = "lblCount";
this.lblCount.Size = new System.Drawing.Size(112, 20); this.lblCount.Size = new System.Drawing.Size(112, 20);
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
// cmbCount // cmbCount
// //
this.cmbCount.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCount.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCount.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbCount.FormattingEnabled = true; this.cmbCount.FormattingEnabled = true;
this.cmbCount.Items.AddRange(new object[] { this.cmbCount.Items.AddRange(new object[] {
"1", "1",
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
"20"}); "20"});
this.cmbCount.Location = new System.Drawing.Point(441, 54); this.cmbCount.Location = new System.Drawing.Point(441, 54);
this.cmbCount.Name = "cmbCount"; this.cmbCount.Name = "cmbCount";
this.cmbCount.Size = new System.Drawing.Size(58, 28); this.cmbCount.Size = new System.Drawing.Size(58, 25);
this.cmbCount.TabIndex = 14; this.cmbCount.TabIndex = 14;
// //
// richTextBox2 // richTextBox2
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
// btnClearLog // btnClearLog
// //
this.btnClearLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnClearLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClearLog.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnClearLog.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClearLog.Location = new System.Drawing.Point(1096, 13); this.btnClearLog.Location = new System.Drawing.Point(1096, 13);
this.btnClearLog.Name = "btnClearLog"; this.btnClearLog.Name = "btnClearLog";
this.btnClearLog.Size = new System.Drawing.Size(110, 35); this.btnClearLog.Size = new System.Drawing.Size(110, 35);
...@@ -241,10 +241,10 @@ ...@@ -241,10 +241,10 @@
this.chbTest.AutoSize = true; this.chbTest.AutoSize = true;
this.chbTest.Checked = true; this.chbTest.Checked = true;
this.chbTest.CheckState = System.Windows.Forms.CheckState.Checked; this.chbTest.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbTest.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbTest.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbTest.Location = new System.Drawing.Point(525, 56); this.chbTest.Location = new System.Drawing.Point(525, 56);
this.chbTest.Name = "chbTest"; this.chbTest.Name = "chbTest";
this.chbTest.Size = new System.Drawing.Size(168, 24); this.chbTest.Size = new System.Drawing.Size(147, 21);
this.chbTest.TabIndex = 17; this.chbTest.TabIndex = 17;
this.chbTest.Text = "学习结束自动识别测试"; this.chbTest.Text = "学习结束自动识别测试";
this.chbTest.UseVisualStyleBackColor = true; this.chbTest.UseVisualStyleBackColor = true;
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
// //
// btnSelImage // btnSelImage
// //
this.btnSelImage.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSelImage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSelImage.Location = new System.Drawing.Point(783, 15); this.btnSelImage.Location = new System.Drawing.Point(783, 15);
this.btnSelImage.Name = "btnSelImage"; this.btnSelImage.Name = "btnSelImage";
this.btnSelImage.Size = new System.Drawing.Size(160, 32); this.btnSelImage.Size = new System.Drawing.Size(160, 32);
...@@ -285,10 +285,10 @@ ...@@ -285,10 +285,10 @@
// chbUseCamera // chbUseCamera
// //
this.chbUseCamera.AutoSize = true; this.chbUseCamera.AutoSize = true;
this.chbUseCamera.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbUseCamera.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbUseCamera.Location = new System.Drawing.Point(525, 18); this.chbUseCamera.Location = new System.Drawing.Point(525, 18);
this.chbUseCamera.Name = "chbUseCamera"; this.chbUseCamera.Name = "chbUseCamera";
this.chbUseCamera.Size = new System.Drawing.Size(140, 24); this.chbUseCamera.Size = new System.Drawing.Size(123, 21);
this.chbUseCamera.TabIndex = 21; this.chbUseCamera.TabIndex = 21;
this.chbUseCamera.Text = "相机获取实时图片"; this.chbUseCamera.Text = "相机获取实时图片";
this.chbUseCamera.UseVisualStyleBackColor = true; this.chbUseCamera.UseVisualStyleBackColor = true;
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
// //
// btnDelOld // btnDelOld
// //
this.btnDelOld.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnDelOld.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelOld.Location = new System.Drawing.Point(783, 53); this.btnDelOld.Location = new System.Drawing.Point(783, 53);
this.btnDelOld.Name = "btnDelOld"; this.btnDelOld.Name = "btnDelOld";
this.btnDelOld.Size = new System.Drawing.Size(160, 32); this.btnDelOld.Size = new System.Drawing.Size(160, 32);
...@@ -319,10 +319,10 @@ ...@@ -319,10 +319,10 @@
// chbHalcon // chbHalcon
// //
this.chbHalcon.AutoSize = true; this.chbHalcon.AutoSize = true;
this.chbHalcon.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbHalcon.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbHalcon.Location = new System.Drawing.Point(344, 19); this.chbHalcon.Location = new System.Drawing.Point(344, 19);
this.chbHalcon.Name = "chbHalcon"; this.chbHalcon.Name = "chbHalcon";
this.chbHalcon.Size = new System.Drawing.Size(132, 24); this.chbHalcon.Size = new System.Drawing.Size(115, 21);
this.chbHalcon.TabIndex = 24; this.chbHalcon.TabIndex = 24;
this.chbHalcon.Text = "Halcon获取图片"; this.chbHalcon.Text = "Halcon获取图片";
this.chbHalcon.UseVisualStyleBackColor = true; this.chbHalcon.UseVisualStyleBackColor = true;
...@@ -331,11 +331,11 @@ ...@@ -331,11 +331,11 @@
// cmbCamera // cmbCamera
// //
this.cmbCamera.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCamera.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCamera.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbCamera.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbCamera.FormattingEnabled = true; this.cmbCamera.FormattingEnabled = true;
this.cmbCamera.Location = new System.Drawing.Point(131, 17); this.cmbCamera.Location = new System.Drawing.Point(131, 17);
this.cmbCamera.Name = "cmbCamera"; this.cmbCamera.Name = "cmbCamera";
this.cmbCamera.Size = new System.Drawing.Size(186, 28); this.cmbCamera.Size = new System.Drawing.Size(186, 25);
this.cmbCamera.TabIndex = 25; this.cmbCamera.TabIndex = 25;
// //
// FrmCodeLearn // FrmCodeLearn
......
...@@ -22,7 +22,11 @@ namespace CodeLibrary ...@@ -22,7 +22,11 @@ namespace CodeLibrary
{ {
InitializeComponent(); InitializeComponent();
} }
private string selCamera =CodeResourceControl.GetString(CodeResourceControl.selCamera, "请先选择相机");
private string selImage = CodeResourceControl.GetString(CodeResourceControl.selImage, "请先选择图片");
private string title = CodeResourceControl.GetString(CodeResourceControl.title, "提示");
private string imageIsNull = CodeResourceControl.GetString(CodeResourceControl.imageIsNull, "获取二维码图片为空");
private string sureDelete = CodeResourceControl.GetString(CodeResourceControl.sureDelete, "确定删除文件:");
private Bitmap GetCameraBitmap() private Bitmap GetCameraBitmap()
{ {
Bitmap bitmap = null; Bitmap bitmap = null;
...@@ -30,7 +34,7 @@ namespace CodeLibrary ...@@ -30,7 +34,7 @@ namespace CodeLibrary
string camerName = cmbCamera.Text; string camerName = cmbCamera.Text;
if (index < 0) if (index < 0)
{ {
MessageBox.Show("请先选择相机"); MessageBox.Show(selCamera);
return null; return null;
} }
if (baslerNameList.Contains(camerName)) if (baslerNameList.Contains(camerName))
...@@ -62,7 +66,7 @@ namespace CodeLibrary ...@@ -62,7 +66,7 @@ namespace CodeLibrary
cameraName = cmbHalconCamera.Text; cameraName = cmbHalconCamera.Text;
if (cameraName.Equals("")) if (cameraName.Equals(""))
{ {
MessageBox.Show("请先选择相机", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selCamera,title, MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
} }
...@@ -87,7 +91,7 @@ namespace CodeLibrary ...@@ -87,7 +91,7 @@ namespace CodeLibrary
if (pictureBox1.Image == null) if (pictureBox1.Image == null)
{ {
MessageBox.Show("请先选择图片", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selImage,title ,MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
Bitmap bitmap = new Bitmap( pictureBox1.Image); Bitmap bitmap = new Bitmap( pictureBox1.Image);
...@@ -217,8 +221,8 @@ namespace CodeLibrary ...@@ -217,8 +221,8 @@ namespace CodeLibrary
private void btnSelImage_Click(object sender, EventArgs e) private void btnSelImage_Click(object sender, EventArgs e)
{ {
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog(); System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "选择二维码图片"; openDialog.Title = selImage;
openDialog.Filter = "图片(*.jpg)|*.jpg|图片(*.png)|*.png|图片(*.bmp)|*.bmp"; openDialog.Filter = "(*.jpg)|*.jpg|(*.png)|*.png|(*.bmp)|*.bmp";
//openDialog.DefaultExt = "png"; //openDialog.DefaultExt = "png";
System.Windows.Forms.DialogResult result = openDialog.ShowDialog(); System.Windows.Forms.DialogResult result = openDialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.Cancel) if (result == System.Windows.Forms.DialogResult.Cancel)
...@@ -229,7 +233,7 @@ namespace CodeLibrary ...@@ -229,7 +233,7 @@ namespace CodeLibrary
string filename = txtPath.Text; string filename = txtPath.Text;
if (string.IsNullOrEmpty(filename)) if (string.IsNullOrEmpty(filename))
{ {
MessageBox.Show("获取二维码图片为空"); MessageBox.Show(imageIsNull);
} }
pictureBox1.Image = null; pictureBox1.Image = null;
//读取图片内容 //读取图片内容
...@@ -260,7 +264,7 @@ namespace CodeLibrary ...@@ -260,7 +264,7 @@ namespace CodeLibrary
} }
FileInfo file = new FileInfo(path); FileInfo file = new FileInfo(path);
DialogResult result = MessageBox.Show("确定删除文件:" +file.Name+ "", "确认删除", MessageBoxButtons.YesNo); DialogResult result = MessageBox.Show(sureDelete +file.Name+ "", title, MessageBoxButtons.YesNo);
if (result.Equals(DialogResult.Yes)) if (result.Equals(DialogResult.Yes))
{ {
File.Delete(path); File.Delete(path);
......
...@@ -31,3 +31,8 @@ FrmCodeLearn_label1_Text,相机:,camera: ...@@ -31,3 +31,8 @@ FrmCodeLearn_label1_Text,相机:,camera:
FrmCodeLearn_btnExit_Text,退出,Exit FrmCodeLearn_btnExit_Text,退出,Exit
FrmCodeLearn_btnStop_Text,结束学习,End of learning FrmCodeLearn_btnStop_Text,结束学习,End of learning
FrmCodeLearn_btnOpen_Text,开始学习,start to learn FrmCodeLearn_btnOpen_Text,开始学习,start to learn
selCamera,请先选择相机,Please select camera
selImage,请先选择图片,Please select picture
title,提示,Notice
imageIsNull,获取二维码图片为空,Get the two-dimensional code picture is empty
sureDelete,确定删除文件:,Make sure to delete the file:
\ No newline at end of file \ No newline at end of file
...@@ -65,7 +65,7 @@ namespace OnLineStore.Common ...@@ -65,7 +65,7 @@ namespace OnLineStore.Common
} }
sw.Close(); sw.Close();
fs.Close(); fs.Close();
DialogResult result = MessageBox.Show("CSV文件保存成功!"); //DialogResult result = MessageBox.Show("CSV文件保存成功!");
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!