Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
AccAOI
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f7f6a7c2
由
贾鹏旭
编写于
2023-08-10 14:46:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
注释GC回收
1 个父辈
7dfece50
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
27 行删除
AccAOI/FrmAoiSetting.cs
AccAOI/FrmAoiSetting.cs
查看文件 @
f7f6a7c
...
@@ -32,7 +32,7 @@ namespace AccAOI
...
@@ -32,7 +32,7 @@ namespace AccAOI
}
}
public
FrmAoiSetting
(
string
programPath
,
Image
image
=
null
,
string
defaultPath
=
""
)
public
FrmAoiSetting
(
string
programPath
,
Image
image
=
null
,
string
defaultPath
=
""
)
{
{
InitializeComponent
();
InitializeComponent
();
this
.
Width
=
Screen
.
PrimaryScreen
.
WorkingArea
.
Width
;
this
.
Width
=
Screen
.
PrimaryScreen
.
WorkingArea
.
Width
;
this
.
Height
=
Screen
.
PrimaryScreen
.
WorkingArea
.
Height
;
this
.
Height
=
Screen
.
PrimaryScreen
.
WorkingArea
.
Height
;
this
.
WindowState
=
FormWindowState
.
Maximized
;
this
.
WindowState
=
FormWindowState
.
Maximized
;
...
@@ -61,7 +61,7 @@ namespace AccAOI
...
@@ -61,7 +61,7 @@ namespace AccAOI
DefaultPath
=
defaultPath
;
DefaultPath
=
defaultPath
;
}
}
string
CurrentCamera
=
""
;
string
CurrentCamera
=
""
;
private
void
FrmAoiSetting_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmAoiSetting_Load
(
object
sender
,
EventArgs
e
)
{
{
LoadTypes
();
LoadTypes
();
...
@@ -86,7 +86,7 @@ namespace AccAOI
...
@@ -86,7 +86,7 @@ namespace AccAOI
}
}
}
}
private
void
LoadTypes
()
private
void
LoadTypes
()
{
{
...
@@ -102,7 +102,7 @@ namespace AccAOI
...
@@ -102,7 +102,7 @@ namespace AccAOI
private
void
btnOpenImage_Click
(
object
sender
,
EventArgs
e
)
private
void
btnOpenImage_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
=
AOIResourceCulture
.
GetValue
(
"打开本地图片"
);
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
.
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"
;
...
@@ -306,7 +306,7 @@ namespace AccAOI
...
@@ -306,7 +306,7 @@ namespace AccAOI
string
defaultName
=
Project
.
methodMap
.
Values
.
Count
.
ToString
().
PadLeft
(
2
,
'0'
)
+
"_"
+
text
;
string
defaultName
=
Project
.
methodMap
.
Values
.
Count
.
ToString
().
PadLeft
(
2
,
'0'
)
+
"_"
+
text
;
FrmMethodName
frmName
=
new
FrmMethodName
(
defaultName
,
new
List
<
string
>(
Project
.
methodMap
.
Keys
));
FrmMethodName
frmName
=
new
FrmMethodName
(
defaultName
,
new
List
<
string
>(
Project
.
methodMap
.
Keys
));
frmName
.
Text
=
AOIResourceCulture
.
GetValue
(
"请输入新【{0}】名称"
,
text
);
frmName
.
Text
=
AOIResourceCulture
.
GetValue
(
"请输入新【{0}】名称"
,
text
);
DialogResult
result
=
frmName
.
ShowDialog
();
DialogResult
result
=
frmName
.
ShowDialog
();
if
(
result
.
Equals
(
DialogResult
.
OK
))
if
(
result
.
Equals
(
DialogResult
.
OK
))
{
{
...
@@ -318,7 +318,7 @@ namespace AccAOI
...
@@ -318,7 +318,7 @@ namespace AccAOI
}
}
CloseCurrAoi
();
CloseCurrAoi
();
// methodInfo.MethodName = Project.methodMap.Values.Count.ToString().PadLeft(2, '0') + "_" + text;
// methodInfo.MethodName = Project.methodMap.Values.Count.ToString().PadLeft(2, '0') + "_" + text;
Project
.
methodMap
.
Add
(
methodInfo
.
MethodName
,
methodInfo
);
Project
.
methodMap
.
Add
(
methodInfo
.
MethodName
,
methodInfo
);
ShowAoi
(
methodInfo
);
ShowAoi
(
methodInfo
);
aoiList
.
ItemAdd
(
methodInfo
.
MethodName
);
aoiList
.
ItemAdd
(
methodInfo
.
MethodName
);
...
@@ -421,14 +421,14 @@ namespace AccAOI
...
@@ -421,14 +421,14 @@ namespace AccAOI
}
}
}
}
private
void
aoiList_IndexChanged
(
object
sender
)
private
void
aoiList_IndexChanged
(
object
sender
)
{
{
// int index = aoiList.SelectedIndex;
// int index = aoiList.SelectedIndex;
if
(
aoiList
.
SelectedIndex
>=
0
&&
(
Project
!=
null
))
if
(
aoiList
.
SelectedIndex
>=
0
&&
(
Project
!=
null
))
{
{
string
text
=
aoiList
.
Text
;
string
text
=
aoiList
.
Text
;
// List<AoiMethod> methods = new List<AoiMethod>(Project.methodMap.Values);
// List<AoiMethod> methods = new List<AoiMethod>(Project.methodMap.Values);
if
(
Project
.
methodMap
.
ContainsKey
(
text
))
if
(
Project
.
methodMap
.
ContainsKey
(
text
))
{
{
AoiMethod
method
=
Project
.
methodMap
[
text
];
AoiMethod
method
=
Project
.
methodMap
[
text
];
if
(
aoiControl
!=
null
&&
aoiControl
.
TitleName
.
Equals
(
method
.
MethodName
))
if
(
aoiControl
!=
null
&&
aoiControl
.
TitleName
.
Equals
(
method
.
MethodName
))
...
@@ -506,13 +506,13 @@ namespace AccAOI
...
@@ -506,13 +506,13 @@ namespace AccAOI
lblTestResult
.
Text
=
"Result: null"
;
lblTestResult
.
Text
=
"Result: null"
;
}
}
else
else
{
{
lblTestResult
.
Text
=
ControlUtil
.
GetResultsStr
(
result
);
lblTestResult
.
Text
=
ControlUtil
.
GetResultsStr
(
result
);
}
}
GC
.
Collect
();
//
GC.Collect();
CanSel
=
true
;
CanSel
=
true
;
}
}
private
void
btnDel_Click
(
object
sender
,
EventArgs
e
)
private
void
btnDel_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
BaseImg
==
null
)
if
(
BaseImg
==
null
)
...
@@ -637,23 +637,23 @@ namespace AccAOI
...
@@ -637,23 +637,23 @@ namespace AccAOI
private
void
btnUpdateName_Click
(
object
sender
,
EventArgs
e
)
private
void
btnUpdateName_Click
(
object
sender
,
EventArgs
e
)
{
{
// int index = aoiList.SelectedIndex;
// int index = aoiList.SelectedIndex;
if
(
aoiList
.
SelectedIndex
>=
0
&&
(
Project
!=
null
)
&&(
aoiControl
!=
null
))
if
(
aoiList
.
SelectedIndex
>=
0
&&
(
Project
!=
null
)
&&
(
aoiControl
!=
null
))
{
{
string
oldName
=
aoiList
.
Text
;
string
oldName
=
aoiList
.
Text
;
if
(
Project
.
methodMap
.
ContainsKey
(
oldName
))
if
(
Project
.
methodMap
.
ContainsKey
(
oldName
))
{
{
// AoiMethod method = methods[index];
// AoiMethod method = methods[index];
// string oldName = methods[index].MethodName;
// string oldName = methods[index].MethodName;
List
<
string
>
allName
=
new
List
<
string
>(
Project
.
methodMap
.
Keys
);
List
<
string
>
allName
=
new
List
<
string
>(
Project
.
methodMap
.
Keys
);
allName
.
Remove
(
oldName
);
allName
.
Remove
(
oldName
);
FrmMethodName
frmName
=
new
FrmMethodName
(
oldName
,
allName
);
FrmMethodName
frmName
=
new
FrmMethodName
(
oldName
,
allName
);
frmName
.
Text
=
AOIResourceCulture
.
GetValue
(
"请输入修改后的名称"
);
frmName
.
Text
=
AOIResourceCulture
.
GetValue
(
"请输入修改后的名称"
);
DialogResult
result
=
frmName
.
ShowDialog
();
DialogResult
result
=
frmName
.
ShowDialog
();
if
(
result
.
Equals
(
DialogResult
.
OK
))
if
(
result
.
Equals
(
DialogResult
.
OK
))
{
{
string
newName
=
frmName
.
MethodName
;
string
newName
=
frmName
.
MethodName
;
if
(
newName
.
Equals
(
oldName
))
if
(
newName
.
Equals
(
oldName
))
{
{
return
;
return
;
...
@@ -670,19 +670,19 @@ namespace AccAOI
...
@@ -670,19 +670,19 @@ namespace AccAOI
aoiList
.
ItemAdd
(
m
.
MethodName
);
aoiList
.
ItemAdd
(
m
.
MethodName
);
}
}
aoiControl
.
TitleName
=
newName
;
aoiControl
.
TitleName
=
newName
;
}
}
else
else
{
{
return
;
return
;
}
}
}
}
if
(
imageBox1
.
Visible
.
Equals
(
false
))
if
(
imageBox1
.
Visible
.
Equals
(
false
))
{
{
btnImageChange_Click
(
null
,
null
);
btnImageChange_Click
(
null
,
null
);
}
}
}
}
}
}
private
void
lblCurrImage_Click
(
object
sender
,
EventArgs
e
)
private
void
lblCurrImage_Click
(
object
sender
,
EventArgs
e
)
...
@@ -714,7 +714,8 @@ namespace AccAOI
...
@@ -714,7 +714,8 @@ namespace AccAOI
needSaveImage
.
Save
(
fileName
,
ImageFormat
.
Bmp
);
needSaveImage
.
Save
(
fileName
,
ImageFormat
.
Bmp
);
MyMessage
.
Show
(
"保存成功"
);
MyMessage
.
Show
(
"保存成功"
);
}
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
{
MessageBox
.
Show
(
ex
.
ToString
());
MessageBox
.
Show
(
ex
.
ToString
());
}
}
...
@@ -755,7 +756,7 @@ namespace AccAOI
...
@@ -755,7 +756,7 @@ namespace AccAOI
{
{
if
(
aoiControl
!=
null
&&
aoiControl
.
Visible
)
if
(
aoiControl
!=
null
&&
aoiControl
.
Visible
)
{
{
//保存原来的
//保存原来的
AoiMethod
OldMethod
=
aoiControl
.
GetAoiInfo
();
AoiMethod
OldMethod
=
aoiControl
.
GetAoiInfo
();
AoiMethod
methodInfo
=
OldMethod
.
GetClone
();
AoiMethod
methodInfo
=
OldMethod
.
GetClone
();
string
text
=
ControlUtil
.
GetMethodType
(
methodInfo
);
string
text
=
ControlUtil
.
GetMethodType
(
methodInfo
);
...
@@ -783,7 +784,7 @@ namespace AccAOI
...
@@ -783,7 +784,7 @@ namespace AccAOI
btnImageChange_Click
(
null
,
null
);
btnImageChange_Click
(
null
,
null
);
}
}
}
}
}
}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论