Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
GeneralClassLibrary
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 66ddccc5
由
LN
编写于
2021-05-21 09:12:37 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
bug修改
1 个父辈
039f60a0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
58 行增加
和
2 行删除
CodeLibraryProject/CodeLibrary/FrmCodeDecode.Designer.cs
CodeLibraryProject/CodeLibrary/FrmCodeDecode.cs
CodeLibraryProject/CodeLibrary/eyemDecode.cs
CodeLibraryProject/CodeLibrary/FrmCodeDecode.Designer.cs
查看文件 @
66ddccc
...
@@ -87,6 +87,7 @@
...
@@ -87,6 +87,7 @@
this
.
pictureBox1
.
SizeMode
=
System
.
Windows
.
Forms
.
PictureBoxSizeMode
.
Zoom
;
this
.
pictureBox1
.
SizeMode
=
System
.
Windows
.
Forms
.
PictureBoxSizeMode
.
Zoom
;
this
.
pictureBox1
.
TabIndex
=
2
;
this
.
pictureBox1
.
TabIndex
=
2
;
this
.
pictureBox1
.
TabStop
=
false
;
this
.
pictureBox1
.
TabStop
=
false
;
this
.
pictureBox1
.
DoubleClick
+=
new
System
.
EventHandler
(
this
.
pictureBox1_DoubleClick
);
//
//
// txtResult
// txtResult
//
//
...
...
CodeLibraryProject/CodeLibrary/FrmCodeDecode.cs
查看文件 @
66ddccc
...
@@ -641,6 +641,58 @@ namespace CodeLibrary
...
@@ -641,6 +641,58 @@ namespace CodeLibrary
Clipboard
.
SetDataObject
(
text
);
Clipboard
.
SetDataObject
(
text
);
}
}
private
void
pictureBox1_DoubleClick
(
object
sender
,
EventArgs
e
)
{
if
(
pictureBox1
.
Image
!=
null
)
{
Bitmap
map
=
new
Bitmap
(
pictureBox1
.
Image
);
SaveImageToFile
(
map
);
}
else
if
(
HDCodeLearnHelper
.
DefaultImage
!=
null
)
{
SaveImageToFile
(
HDCodeLearnHelper
.
DefaultImage
);
}
}
private
static
string
GetFName
()
{
string
date
=
DateTime
.
Now
.
ToString
(
"yyyyMMdd-HHmmss"
)
+
"-"
+
DateTime
.
Now
.
Millisecond
.
ToString
().
PadLeft
(
4
,
'0'
);
string
dire
=
@"D:\image\"
;
string
iamgeName
=
date
+
".bmp"
;
if
(!
Directory
.
Exists
(
dire
))
{
Directory
.
CreateDirectory
(
dire
);
}
return
dire
+
iamgeName
;
}
private
static
void
SaveImageToFile
(
HalconDotNet
.
HObject
bitmap
)
{
try
{
string
imgName
=
GetFName
();
bitmap
.
WriteObject
(
imgName
);
HDLogUtil
.
info
(
"保存图片到【"
+
imgName
+
"】成功"
);
MessageBox
.
Show
(
imgName
);
}
catch
(
Exception
ex
)
{
HDLogUtil
.
error
(
"保存 图片出错"
+
ex
.
ToString
());
}
}
private
static
void
SaveImageToFile
(
Bitmap
bitmap
)
{
try
{
string
imgName
=
GetFName
();
Bitmap
bit
=
(
Bitmap
)
bitmap
.
Clone
();
bit
.
Save
(
imgName
,
ImageFormat
.
Bmp
);
HDLogUtil
.
info
(
"保存图片到【"
+
imgName
+
"】成功"
);
MessageBox
.
Show
(
imgName
);
}
catch
(
Exception
ex
)
{
HDLogUtil
.
error
(
"保存图片出错"
+
ex
.
ToString
());
}
}
}
}
}
}
CodeLibraryProject/CodeLibrary/eyemDecode.cs
查看文件 @
66ddccc
...
@@ -72,9 +72,12 @@ namespace CodeLibrary
...
@@ -72,9 +72,12 @@ namespace CodeLibrary
if
(
bmap
.
PixelFormat
.
Equals
(
PixelFormat
.
Format8bppIndexed
))
if
(
bmap
.
PixelFormat
.
Equals
(
PixelFormat
.
Format8bppIndexed
))
{
{
eyemImage
.
iChannels
=
1
;
eyemImage
.
iChannels
=
1
;
}
else
}
else
if
(
bmap
.
PixelFormat
.
Equals
(
PixelFormat
.
Format24bppRgb
))
{
{
eyemImage
.
iChannels
=
3
;
eyemImage
.
iChannels
=
3
;
}
else
{
eyemImage
.
iChannels
=
4
;
}
}
eyemImage
.
iDepth
=
0
;
eyemImage
.
iDepth
=
0
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论