Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 93e26866
由
张东亮
编写于
2023-04-23 16:15:59 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
重新获取条码时添加提示信息:清除模板
1 个父辈
a291af67
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
100 行增加
和
75 行删除
Model/LanguageDialogKey.cs
SharedDll/halcondotnet.dll
SmartScan/SetControl/UsrMaterialTemplate.Designer.cs
SmartScan/SetControl/UsrMaterialTemplate.cs
Model/LanguageDialogKey.cs
查看文件 @
93e2686
...
...
@@ -16,6 +16,6 @@ namespace Model
public
const
string
MATERIAL_TEMPLATE_DEL
=
"MaterialTemplateDel"
;
public
const
string
MATERIAL_TEMPLATE_RENAME
=
"MaterialTemplateRename"
;
public
const
string
SAVE_SUCCEED
=
"SaveSucceed"
;
public
const
string
REMIND_CLEARTEMPLATE
=
"RemindClearTemplate"
;
}
}
SharedDll/halcondotnet.dll
0 → 100644
查看文件 @
93e2686
此文件类型无法预览
SmartScan/SetControl/UsrMaterialTemplate.Designer.cs
查看文件 @
93e2686
...
...
@@ -68,9 +68,9 @@ namespace SmartScan
this
.
facePanel1
.
Controls
.
Add
(
this
.
LstMate
);
this
.
facePanel1
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
facePanel1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
4
);
this
.
facePanel1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
facePanel1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
facePanel1
.
Name
=
"facePanel1"
;
this
.
facePanel1
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
facePanel1
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
facePanel1
.
ShowText
=
false
;
this
.
facePanel1
.
Size
=
new
System
.
Drawing
.
Size
(
1173
,
536
);
this
.
facePanel1
.
TabIndex
=
1
;
...
...
@@ -86,9 +86,9 @@ namespace SmartScan
this
.
BtnExtractCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnExtractCode
.
HoldPress
=
false
;
this
.
BtnExtractCode
.
Location
=
new
System
.
Drawing
.
Point
(
243
,
409
);
this
.
BtnExtractCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnExtractCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnExtractCode
.
Name
=
"BtnExtractCode"
;
this
.
BtnExtractCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnExtractCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnExtractCode
.
Size
=
new
System
.
Drawing
.
Size
(
461
,
56
);
this
.
BtnExtractCode
.
TabIndex
=
17
;
this
.
BtnExtractCode
.
Text
=
"条码提取"
;
...
...
@@ -103,12 +103,13 @@ namespace SmartScan
this
.
BtnOcrCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnOcrCode
.
HoldPress
=
false
;
this
.
BtnOcrCode
.
Location
=
new
System
.
Drawing
.
Point
(
243
,
473
);
this
.
BtnOcrCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnOcrCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnOcrCode
.
Name
=
"BtnOcrCode"
;
this
.
BtnOcrCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnOcrCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnOcrCode
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnOcrCode
.
TabIndex
=
16
;
this
.
BtnOcrCode
.
Text
=
"OCR"
;
this
.
BtnOcrCode
.
Visible
=
false
;
this
.
BtnOcrCode
.
Click
+=
new
System
.
EventHandler
(
this
.
BtnOcrCode_Click
);
//
// BtnPrimaryCode
...
...
@@ -120,9 +121,9 @@ namespace SmartScan
this
.
BtnPrimaryCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnPrimaryCode
.
HoldPress
=
false
;
this
.
BtnPrimaryCode
.
Location
=
new
System
.
Drawing
.
Point
(
477
,
472
);
this
.
BtnPrimaryCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnPrimaryCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnPrimaryCode
.
Name
=
"BtnPrimaryCode"
;
this
.
BtnPrimaryCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnPrimaryCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnPrimaryCode
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnPrimaryCode
.
TabIndex
=
15
;
this
.
BtnPrimaryCode
.
Text
=
"特征码"
;
...
...
@@ -138,9 +139,9 @@ namespace SmartScan
this
.
ImgShow
.
BorderWidth
=
2
;
this
.
ImgShow
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
ImgShow
.
Location
=
new
System
.
Drawing
.
Point
(
712
,
8
);
this
.
ImgShow
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
ImgShow
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
ImgShow
.
Name
=
"ImgShow"
;
this
.
ImgShow
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
ImgShow
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
ImgShow
.
Size
=
new
System
.
Drawing
.
Size
(
453
,
521
);
this
.
ImgShow
.
TabIndex
=
14
;
this
.
ImgShow
.
Text
=
"facePictureBox1"
;
...
...
@@ -156,9 +157,9 @@ namespace SmartScan
this
.
LstCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
LstCode
.
ItemHeight
=
40
;
this
.
LstCode
.
Location
=
new
System
.
Drawing
.
Point
(
243
,
135
);
this
.
LstCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
LstCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
LstCode
.
Name
=
"LstCode"
;
this
.
LstCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
LstCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
LstCode
.
SelectedIndex
=
-
1
;
this
.
LstCode
.
Size
=
new
System
.
Drawing
.
Size
(
461
,
266
);
this
.
LstCode
.
TabIndex
=
13
;
...
...
@@ -173,9 +174,9 @@ namespace SmartScan
this
.
BtnScanCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnScanCode
.
HoldPress
=
false
;
this
.
BtnScanCode
.
Location
=
new
System
.
Drawing
.
Point
(
243
,
71
);
this
.
BtnScanCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnScanCode
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnScanCode
.
Name
=
"BtnScanCode"
;
this
.
BtnScanCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnScanCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnScanCode
.
Size
=
new
System
.
Drawing
.
Size
(
461
,
56
);
this
.
BtnScanCode
.
TabIndex
=
12
;
this
.
BtnScanCode
.
Text
=
"条码识别"
;
...
...
@@ -189,9 +190,9 @@ namespace SmartScan
this
.
BtnLocalImage
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnLocalImage
.
HoldPress
=
false
;
this
.
BtnLocalImage
.
Location
=
new
System
.
Drawing
.
Point
(
477
,
8
);
this
.
BtnLocalImage
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnLocalImage
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnLocalImage
.
Name
=
"BtnLocalImage"
;
this
.
BtnLocalImage
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnLocalImage
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnLocalImage
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnLocalImage
.
TabIndex
=
11
;
this
.
BtnLocalImage
.
Text
=
"本地图像"
;
...
...
@@ -205,9 +206,9 @@ namespace SmartScan
this
.
BtnCameraImage
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnCameraImage
.
HoldPress
=
false
;
this
.
BtnCameraImage
.
Location
=
new
System
.
Drawing
.
Point
(
243
,
8
);
this
.
BtnCameraImage
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnCameraImage
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnCameraImage
.
Name
=
"BtnCameraImage"
;
this
.
BtnCameraImage
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnCameraImage
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnCameraImage
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnCameraImage
.
TabIndex
=
10
;
this
.
BtnCameraImage
.
Text
=
"相机图像"
;
...
...
@@ -221,9 +222,9 @@ namespace SmartScan
this
.
BtnCloseLight
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnCloseLight
.
HoldPress
=
false
;
this
.
BtnCloseLight
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
454
);
this
.
BtnCloseLight
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnCloseLight
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnCloseLight
.
Name
=
"BtnCloseLight"
;
this
.
BtnCloseLight
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnCloseLight
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnCloseLight
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnCloseLight
.
TabIndex
=
9
;
this
.
BtnCloseLight
.
Text
=
"关闭"
;
...
...
@@ -237,9 +238,9 @@ namespace SmartScan
this
.
BtnOpenLight
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnOpenLight
.
HoldPress
=
false
;
this
.
BtnOpenLight
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
390
);
this
.
BtnOpenLight
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnOpenLight
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnOpenLight
.
Name
=
"BtnOpenLight"
;
this
.
BtnOpenLight
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnOpenLight
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnOpenLight
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnOpenLight
.
TabIndex
=
8
;
this
.
BtnOpenLight
.
Text
=
"打开光源"
;
...
...
@@ -253,9 +254,9 @@ namespace SmartScan
this
.
BtnRenameMate
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnRenameMate
.
HoldPress
=
false
;
this
.
BtnRenameMate
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
326
);
this
.
BtnRenameMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnRenameMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnRenameMate
.
Name
=
"BtnRenameMate"
;
this
.
BtnRenameMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnRenameMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnRenameMate
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnRenameMate
.
TabIndex
=
7
;
this
.
BtnRenameMate
.
Text
=
"重命名"
;
...
...
@@ -269,9 +270,9 @@ namespace SmartScan
this
.
BtnDelMate
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnDelMate
.
HoldPress
=
false
;
this
.
BtnDelMate
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
262
);
this
.
BtnDelMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnDelMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnDelMate
.
Name
=
"BtnDelMate"
;
this
.
BtnDelMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnDelMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnDelMate
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnDelMate
.
TabIndex
=
6
;
this
.
BtnDelMate
.
Text
=
"删除标签"
;
...
...
@@ -285,9 +286,9 @@ namespace SmartScan
this
.
BtnAddMate
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
BtnAddMate
.
HoldPress
=
false
;
this
.
BtnAddMate
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
199
);
this
.
BtnAddMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnAddMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnAddMate
.
Name
=
"BtnAddMate"
;
this
.
BtnAddMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
BtnAddMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnAddMate
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
56
);
this
.
BtnAddMate
.
TabIndex
=
5
;
this
.
BtnAddMate
.
Text
=
"新建标签"
;
...
...
@@ -300,9 +301,9 @@ namespace SmartScan
this
.
LstMate
.
BorderWidth
=
2
;
this
.
LstMate
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
LstMate
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
8
);
this
.
LstMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
LstMate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
LstMate
.
Name
=
"LstMate"
;
this
.
LstMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
LstMate
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
LstMate
.
SelectedIndex
=
-
1
;
this
.
LstMate
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
184
);
this
.
LstMate
.
TabIndex
=
4
;
...
...
@@ -313,7 +314,7 @@ namespace SmartScan
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
8F
,
15F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
Controls
.
Add
(
this
.
facePanel1
);
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
Name
=
"UsrMaterialTemplate"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
1223
,
582
);
this
.
facePanel1
.
ResumeLayout
(
false
);
...
...
SmartScan/SetControl/UsrMaterialTemplate.cs
查看文件 @
93e2686
...
...
@@ -18,7 +18,7 @@ namespace SmartScan
public
UsrMaterialTemplate
()
{
InitializeComponent
();
BtnOcrCode
.
Enabled
=
Config
.
Func_EnabledOCR
;
//
BtnOcrCode.Enabled = Config.Func_EnabledOCR;
LstMate
.
Items
.
AddRange
(
Common
.
mateEdit
.
Name
);
mateCopy
=
Common
.
mateEdit
.
ToCopy
();
Language
.
SetLanguage
(
this
);
...
...
@@ -241,7 +241,14 @@ namespace SmartScan
private
void
BtnScanCode_Click
(
object
sender
,
EventArgs
e
)
{
if
(
bmp
==
null
)
return
;
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
REMIND_CLEARTEMPLATE
,
"Recognizing code will reset the template.Are you sure to perform the action?"
);
DialogResult
dialogResult
=
new
FaceMessageBox
(
mateCopy
[
mateIndex
].
Name
,
text
,
MessageBoxButtons
.
YesNo
).
ShowDialog
();
if
(
dialogResult
==
DialogResult
.
No
)
{
return
;
}
List
<
CameraVisionLib
.
Model
.
BarcodeInfo
>
info
=
Common
.
cameraVision
.
GetBarCode
(
bmp
);
LstCode
.
Items
.
Clear
();
ImgShow
.
CodeCenterClear
();
...
...
@@ -252,13 +259,6 @@ namespace SmartScan
mateCopy
[
mateIndex
].
State
=
TemplateState
.
Unsaved
;
Common
.
mateMaxCodeID
=
info
.
Count
;
if
(
info
.
Count
==
0
)
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
CODE_COUNT
);
new
FaceMessageBox
(
""
,
text
,
MessageBoxButtons
.
OK
).
ShowDialog
();
return
;
}
PointF
[]
lst
=
new
PointF
[
info
.
Count
];
for
(
int
i
=
0
;
i
<
info
.
Count
;
i
++)
{
...
...
@@ -279,10 +279,34 @@ namespace SmartScan
mateCopy
[
mateIndex
].
Code
.
Add
(
code
);
lst
[
i
]
=
info
[
i
].
Center
;
}
if
(
Config
.
Func_EnabledOCR
)
{
//保存需要识别ocr的区域
bmp
?.
Save
(
@"ocrt.jpg"
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
string
[]
regOcrCodes
=
PaddleOCRHelper
.
StartTest
(
"..\\ocrt.jpg"
).
Split
(
';'
);
int
startidx
=
Common
.
mateMaxCodeID
+
1
;
foreach
(
var
ocr
in
regOcrCodes
)
{
if
(
string
.
IsNullOrEmpty
(
ocr
))
continue
;
MaterialCode
code
=
new
()
{
ID
=
startidx
,
Text
=
ocr
,
CodeType
=
Setting_Str
.
OCR
};
mateCopy
[
mateIndex
].
Code
.
Add
(
code
);
startidx
++;
}
}
if
(
mateCopy
[
mateIndex
].
Code
.
Count
==
0
)
{
text
=
Language
.
Dialog
(
LanguageDialogKey
.
CODE_COUNT
);
new
FaceMessageBox
(
""
,
text
,
MessageBoxButtons
.
OK
).
ShowDialog
();
return
;
}
ImgShow
.
AddCodeCenter
(
lst
);
LstCode
.
Items
.
AddRange
(
FormatCode
());
LstCode
.
SelectedIndex
=
codeIndex
=
-
1
;
ImgShow
.
AddCodeCenter
(
lst
);
}
private
void
BtnExtractCode_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -308,40 +332,40 @@ namespace SmartScan
private
void
BtnOcrCode_Click
(
object
sender
,
EventArgs
e
)
{
if
(
bmp
==
null
)
return
;
//保存需要识别ocr的区域
bmp
?.
Save
(
@"ocrt.jpg"
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
string
[]
regOcrCodes
=
PaddleOCRHelper
.
StartTest
(
"..\\ocrt.jpg"
).
Split
(
';'
);
LstCode
.
Items
.
Clear
();
var
ocrs
=
mateCopy
[
mateIndex
].
Code
.
FindAll
(
s
=>
s
.
CodeType
.
Equals
(
Setting_Str
.
OCR
));
foreach
(
var
code
in
ocrs
)
{
mateCopy
[
mateIndex
].
Code
.
Remove
(
code
);
}
mateCopy
[
mateIndex
].
Match
.
Clear
();
mateCopy
[
mateIndex
].
Ocr
.
Clear
();
if
(
regOcrCodes
.
Length
==
0
)
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
CODE_COUNT
);
new
FaceMessageBox
(
""
,
text
,
MessageBoxButtons
.
OK
).
ShowDialog
();
return
;
}
mateCopy
[
mateIndex
].
State
=
TemplateState
.
Unsaved
;
int
startidx
=
Common
.
mateMaxCodeID
+
1
;
foreach
(
var
ocr
in
regOcrCodes
)
{
if
(
string
.
IsNullOrEmpty
(
ocr
))
continue
;
MaterialCode
code
=
new
()
{
ID
=
startidx
,
Text
=
ocr
,
CodeType
=
Setting_Str
.
OCR
};
mateCopy
[
mateIndex
].
Code
.
Add
(
code
);
startidx
++;
}
//
//
保存需要识别ocr的区域
//
bmp?.Save(@"ocrt.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
//
string[] regOcrCodes = PaddleOCRHelper.StartTest("..\\ocrt.jpg").Split(';');
//
LstCode.Items.Clear();
//
var ocrs = mateCopy[mateIndex].Code.FindAll(s => s.CodeType.Equals(Setting_Str.OCR));
//
foreach (var code in ocrs)
//
{
//
mateCopy[mateIndex].Code.Remove(code);
//
}
//
mateCopy[mateIndex].Match.Clear();
//
mateCopy[mateIndex].Ocr.Clear();
//
if (regOcrCodes.Length == 0)
//
{
//
string text = Language.Dialog(LanguageDialogKey.CODE_COUNT);
//
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
//
return;
//
}
//
mateCopy[mateIndex].State = TemplateState.Unsaved;
//
int startidx = Common.mateMaxCodeID + 1;
//
foreach (var ocr in regOcrCodes)
//
{
//
if (string.IsNullOrEmpty(ocr)) continue;
//
MaterialCode code = new()
//
{
//
ID = startidx,
//
Text = ocr,
//
CodeType = Setting_Str.OCR
//
};
//
mateCopy[mateIndex].Code.Add(code);
//
startidx++;
//
}
LstCode
.
Items
.
AddRange
(
FormatCode
());
LstCode
.
SelectedIndex
=
codeIndex
=
-
1
;
//
LstCode.Items.AddRange(FormatCode());
//
LstCode.SelectedIndex = codeIndex = -1;
//if (codeIndex == -1) return;
//var m = mateCopy[mateIndex].Match.Find(m=>m.CodeID==codeIndex);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论