Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
PrintLabel
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 82b2f38b
由
刘韬
编写于
2024-02-22 13:21:59 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
1
2 个父辈
fff4105d
ded2484b
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
426 行增加
和
179 行删除
PrintLabel/FrmLabel.Designer.cs
PrintLabel/FrmLabel.cs
PrintLabel/PrintLabel.cs
PrintLabel/PrintLabel.csproj
PrintLabel/packages.config
PrintLabel_Test/App.config
PrintLabel_Test/Form1.Designer.cs
PrintLabel_Test/Form1.cs
PrintLabel_Test/PrintLabel_Test.csproj
PrintLabel_Test/Properties/Resources.Designer.cs
PrintLabel_Test/Properties/Settings.Designer.cs
ZebraDemoSource/App.config
ZebraDemoSource/DeveloperDemo_Windows.csproj
ZebraDemoSource/Properties/Resources.Designer.cs
ZebraDemoSource/Properties/Settings.Designer.cs
ZebraPrinterHelper/App.config
ZebraPrinterHelper/ZebraPrinterHelper.csproj
PrintLabel/FrmLabel.Designer.cs
查看文件 @
82b2f38
...
...
@@ -43,7 +43,6 @@
this
.
NumW
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
this
.
NumH
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
this
.
TxtFormatText
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
pictureBox1
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label2
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
...
...
@@ -56,33 +55,38 @@
this
.
NumLabelH
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
this
.
NumLabelW
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
this
.
label_labelsize
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
pictureBox1
=
new
System
.
Windows
.
Forms
.
PictureBox
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumX
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumY
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumW
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumH
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
BeginInit
();
this
.
groupBox1
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumLabelH
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumLabelW
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
BeginInit
();
this
.
SuspendLayout
();
//
// LstLabelName
//
this
.
LstLabelName
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
LstLabelName
.
FormattingEnabled
=
true
;
this
.
LstLabelName
.
IntegralHeight
=
false
;
this
.
LstLabelName
.
ItemHeight
=
12
;
this
.
LstLabelName
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
12
);
this
.
LstLabelName
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
10
);
this
.
LstLabelName
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
LstLabelName
.
Name
=
"LstLabelName"
;
this
.
LstLabelName
.
Size
=
new
System
.
Drawing
.
Size
(
1
79
,
90
);
this
.
LstLabelName
.
Size
=
new
System
.
Drawing
.
Size
(
1
45
,
112
);
this
.
LstLabelName
.
TabIndex
=
0
;
this
.
LstLabelName
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
LstLabelName_SelectedIndexChanged
);
//
// BtnLabelNew
//
this
.
BtnLabelNew
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnLabelNew
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnLabelNew
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
108
);
this
.
BtnLabelNew
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
134
);
this
.
BtnLabelNew
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnLabelNew
.
Name
=
"BtnLabelNew"
;
this
.
BtnLabelNew
.
Size
=
new
System
.
Drawing
.
Size
(
1
79
,
26
);
this
.
BtnLabelNew
.
Size
=
new
System
.
Drawing
.
Size
(
1
45
,
32
);
this
.
BtnLabelNew
.
TabIndex
=
1
;
this
.
BtnLabelNew
.
Text
=
"新建"
;
this
.
BtnLabelNew
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -90,10 +94,12 @@
//
// BtnLabelDel
//
this
.
BtnLabelDel
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnLabelDel
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnLabelDel
.
Location
=
new
System
.
Drawing
.
Point
(
106
,
140
);
this
.
BtnLabelDel
.
Location
=
new
System
.
Drawing
.
Point
(
92
,
174
);
this
.
BtnLabelDel
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnLabelDel
.
Name
=
"BtnLabelDel"
;
this
.
BtnLabelDel
.
Size
=
new
System
.
Drawing
.
Size
(
85
,
26
);
this
.
BtnLabelDel
.
Size
=
new
System
.
Drawing
.
Size
(
66
,
32
);
this
.
BtnLabelDel
.
TabIndex
=
2
;
this
.
BtnLabelDel
.
Text
=
"删除"
;
this
.
BtnLabelDel
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -101,10 +107,12 @@
//
// BtnRename
//
this
.
BtnRename
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnRename
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnRename
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
140
);
this
.
BtnRename
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
175
);
this
.
BtnRename
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnRename
.
Name
=
"BtnRename"
;
this
.
BtnRename
.
Size
=
new
System
.
Drawing
.
Size
(
85
,
26
);
this
.
BtnRename
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
32
);
this
.
BtnRename
.
TabIndex
=
3
;
this
.
BtnRename
.
Text
=
"重命名"
;
this
.
BtnRename
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -112,10 +120,12 @@
//
// BtnPrintTest
//
this
.
BtnPrintTest
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnPrintTest
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnPrintTest
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
256
);
this
.
BtnPrintTest
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
300
);
this
.
BtnPrintTest
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnPrintTest
.
Name
=
"BtnPrintTest"
;
this
.
BtnPrintTest
.
Size
=
new
System
.
Drawing
.
Size
(
1
79
,
26
);
this
.
BtnPrintTest
.
Size
=
new
System
.
Drawing
.
Size
(
1
45
,
32
);
this
.
BtnPrintTest
.
TabIndex
=
4
;
this
.
BtnPrintTest
.
Text
=
"打印测试"
;
this
.
BtnPrintTest
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -123,10 +133,12 @@
//
// BtnSave
//
this
.
BtnSave
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnSave
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnSave
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
173
);
this
.
BtnSave
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
222
);
this
.
BtnSave
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnSave
.
Name
=
"BtnSave"
;
this
.
BtnSave
.
Size
=
new
System
.
Drawing
.
Size
(
1
79
,
26
);
this
.
BtnSave
.
Size
=
new
System
.
Drawing
.
Size
(
1
45
,
32
);
this
.
BtnSave
.
TabIndex
=
5
;
this
.
BtnSave
.
Text
=
"保存"
;
this
.
BtnSave
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -134,11 +146,12 @@
//
// BtnFieldAdd
//
this
.
BtnFieldAdd
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
BtnFieldAdd
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnFieldAdd
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnFieldAdd
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
14
);
this
.
BtnFieldAdd
.
Location
=
new
System
.
Drawing
.
Point
(
747
,
5
);
this
.
BtnFieldAdd
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnFieldAdd
.
Name
=
"BtnFieldAdd"
;
this
.
BtnFieldAdd
.
Size
=
new
System
.
Drawing
.
Size
(
85
,
26
);
this
.
BtnFieldAdd
.
Size
=
new
System
.
Drawing
.
Size
(
113
,
32
);
this
.
BtnFieldAdd
.
TabIndex
=
6
;
this
.
BtnFieldAdd
.
Text
=
"字段添加"
;
this
.
BtnFieldAdd
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -146,11 +159,12 @@
//
// BtnFieldDel
//
this
.
BtnFieldDel
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
BtnFieldDel
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnFieldDel
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnFieldDel
.
Location
=
new
System
.
Drawing
.
Point
(
755
,
14
);
this
.
BtnFieldDel
.
Location
=
new
System
.
Drawing
.
Point
(
877
,
56
);
this
.
BtnFieldDel
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnFieldDel
.
Name
=
"BtnFieldDel"
;
this
.
BtnFieldDel
.
Size
=
new
System
.
Drawing
.
Size
(
85
,
26
);
this
.
BtnFieldDel
.
Size
=
new
System
.
Drawing
.
Size
(
113
,
32
);
this
.
BtnFieldDel
.
TabIndex
=
7
;
this
.
BtnFieldDel
.
Text
=
"字段删除"
;
this
.
BtnFieldDel
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -158,11 +172,12 @@
//
// BtnFieldFont
//
this
.
BtnFieldFont
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
BtnFieldFont
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
BtnFieldFont
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
BtnFieldFont
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
46
);
this
.
BtnFieldFont
.
Location
=
new
System
.
Drawing
.
Point
(
877
,
5
);
this
.
BtnFieldFont
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
BtnFieldFont
.
Name
=
"BtnFieldFont"
;
this
.
BtnFieldFont
.
Size
=
new
System
.
Drawing
.
Size
(
85
,
26
);
this
.
BtnFieldFont
.
Size
=
new
System
.
Drawing
.
Size
(
113
,
32
);
this
.
BtnFieldFont
.
TabIndex
=
8
;
this
.
BtnFieldFont
.
Text
=
"字段字体"
;
this
.
BtnFieldFont
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -170,62 +185,66 @@
//
// CboFieldType
//
this
.
CboFieldType
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
CboFieldType
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
CboFieldType
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
CboFieldType
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
CboFieldType
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
CboFieldType
.
FormattingEnabled
=
true
;
this
.
CboFieldType
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
83
);
this
.
CboFieldType
.
Location
=
new
System
.
Drawing
.
Point
(
755
,
96
);
this
.
CboFieldType
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
CboFieldType
.
Name
=
"CboFieldType"
;
this
.
CboFieldType
.
Size
=
new
System
.
Drawing
.
Size
(
173
,
23
);
this
.
CboFieldType
.
Size
=
new
System
.
Drawing
.
Size
(
235
,
23
);
this
.
CboFieldType
.
TabIndex
=
9
;
this
.
CboFieldType
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
CboFieldType_SelectedIndexChanged
);
//
// NumX
//
this
.
NumX
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
NumX
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
NumX
.
DecimalPlaces
=
2
;
this
.
NumX
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
NumX
.
Location
=
new
System
.
Drawing
.
Point
(
689
,
112
);
this
.
NumX
.
Location
=
new
System
.
Drawing
.
Point
(
857
,
129
);
this
.
NumX
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
NumX
.
Minimum
=
new
decimal
(
new
int
[]
{
100
,
0
,
0
,
-
2147483648
});
this
.
NumX
.
Name
=
"NumX"
;
this
.
NumX
.
Size
=
new
System
.
Drawing
.
Size
(
98
,
24
);
this
.
NumX
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumX
.
TabIndex
=
10
;
this
.
NumX
.
ValueChanged
+=
new
System
.
EventHandler
(
this
.
NumX_ValueChanged
);
//
// NumY
//
this
.
NumY
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
NumY
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
NumY
.
DecimalPlaces
=
2
;
this
.
NumY
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
NumY
.
Location
=
new
System
.
Drawing
.
Point
(
689
,
142
);
this
.
NumY
.
Location
=
new
System
.
Drawing
.
Point
(
857
,
170
);
this
.
NumY
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
NumY
.
Minimum
=
new
decimal
(
new
int
[]
{
100
,
0
,
0
,
-
2147483648
});
this
.
NumY
.
Name
=
"NumY"
;
this
.
NumY
.
Size
=
new
System
.
Drawing
.
Size
(
98
,
24
);
this
.
NumY
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumY
.
TabIndex
=
11
;
this
.
NumY
.
ValueChanged
+=
new
System
.
EventHandler
(
this
.
NumY_ValueChanged
);
//
// NumW
//
this
.
NumW
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
NumW
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
NumW
.
DecimalPlaces
=
2
;
this
.
NumW
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
NumW
.
Location
=
new
System
.
Drawing
.
Point
(
689
,
172
);
this
.
NumW
.
Location
=
new
System
.
Drawing
.
Point
(
857
,
215
);
this
.
NumW
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
NumW
.
Minimum
=
new
decimal
(
new
int
[]
{
1
,
0
,
0
,
131072
});
this
.
NumW
.
Name
=
"NumW"
;
this
.
NumW
.
Size
=
new
System
.
Drawing
.
Size
(
98
,
24
);
this
.
NumW
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumW
.
TabIndex
=
12
;
this
.
NumW
.
Value
=
new
decimal
(
new
int
[]
{
1
,
...
...
@@ -236,17 +255,18 @@
//
// NumH
//
this
.
NumH
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
NumH
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
NumH
.
DecimalPlaces
=
2
;
this
.
NumH
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
NumH
.
Location
=
new
System
.
Drawing
.
Point
(
689
,
202
);
this
.
NumH
.
Location
=
new
System
.
Drawing
.
Point
(
857
,
255
);
this
.
NumH
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
NumH
.
Minimum
=
new
decimal
(
new
int
[]
{
1
,
0
,
0
,
131072
});
this
.
NumH
.
Name
=
"NumH"
;
this
.
NumH
.
Size
=
new
System
.
Drawing
.
Size
(
98
,
24
);
this
.
NumH
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumH
.
TabIndex
=
13
;
this
.
NumH
.
Value
=
new
decimal
(
new
int
[]
{
1
,
...
...
@@ -257,78 +277,74 @@
//
// TxtFormatText
//
this
.
TxtFormatText
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
TxtFormatText
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
TxtFormatText
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
TxtFormatText
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
232
);
this
.
TxtFormatText
.
Location
=
new
System
.
Drawing
.
Point
(
756
,
291
);
this
.
TxtFormatText
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
TxtFormatText
.
Multiline
=
true
;
this
.
TxtFormatText
.
Name
=
"TxtFormatText"
;
this
.
TxtFormatText
.
ScrollBars
=
System
.
Windows
.
Forms
.
ScrollBars
.
Both
;
this
.
TxtFormatText
.
Size
=
new
System
.
Drawing
.
Size
(
176
,
133
);
this
.
TxtFormatText
.
Size
=
new
System
.
Drawing
.
Size
(
234
,
122
);
this
.
TxtFormatText
.
TabIndex
=
14
;
this
.
TxtFormatText
.
TextChanged
+=
new
System
.
EventHandler
(
this
.
TxtFormatText_TextChanged
);
//
// pictureBox1
//
this
.
pictureBox1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
208
,
46
);
this
.
pictureBox1
.
Name
=
"pictureBox1"
;
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
441
,
671
);
this
.
pictureBox1
.
TabIndex
=
15
;
this
.
pictureBox1
.
TabStop
=
false
;
//
// label1
//
this
.
label1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
label1
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
115
);
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
830
,
133
);
this
.
label1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
1
6
,
16
);
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
1
5
,
16
);
this
.
label1
.
TabIndex
=
16
;
this
.
label1
.
Text
=
"X"
;
//
// label2
//
this
.
label2
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
label2
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
label2
.
AutoSize
=
true
;
this
.
label2
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
145
);
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
830
,
177
);
this
.
label2
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
1
6
,
16
);
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
1
5
,
16
);
this
.
label2
.
TabIndex
=
17
;
this
.
label2
.
Text
=
"Y"
;
//
// label3
//
this
.
label3
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
label3
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
175
);
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
830
,
219
);
this
.
label3
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
1
6
,
16
);
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
1
5
,
16
);
this
.
label3
.
TabIndex
=
18
;
this
.
label3
.
Text
=
"W"
;
//
// label4
//
this
.
label4
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
label4
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
label4
.
AutoSize
=
true
;
this
.
label4
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label4
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
205
);
this
.
label4
.
Location
=
new
System
.
Drawing
.
Point
(
830
,
259
);
this
.
label4
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label4
.
Name
=
"label4"
;
this
.
label4
.
Size
=
new
System
.
Drawing
.
Size
(
1
6
,
16
);
this
.
label4
.
Size
=
new
System
.
Drawing
.
Size
(
1
5
,
16
);
this
.
label4
.
TabIndex
=
19
;
this
.
label4
.
Text
=
"H"
;
//
// groupBox1
//
this
.
groupBox1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
groupBox1
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
groupBox1
.
Controls
.
Add
(
this
.
label_desc
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
400
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
755
,
466
);
this
.
groupBox1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
groupBox1
.
Name
=
"groupBox1"
;
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
176
,
167
);
this
.
groupBox1
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
235
,
209
);
this
.
groupBox1
.
TabIndex
=
20
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"字段说明"
;
...
...
@@ -336,60 +352,63 @@
// label_desc
//
this
.
label_desc
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
label_desc
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
17
);
this
.
label_desc
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
18
);
this
.
label_desc
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label_desc
.
Name
=
"label_desc"
;
this
.
label_desc
.
Size
=
new
System
.
Drawing
.
Size
(
170
,
14
7
);
this
.
label_desc
.
Size
=
new
System
.
Drawing
.
Size
(
227
,
18
7
);
this
.
label_desc
.
TabIndex
=
0
;
this
.
label_desc
.
Text
=
" "
;
//
// cb_keyword
//
this
.
cb_keyword
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
cb_keyword
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
cb_keyword
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
cb_keyword
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
cb_keyword
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
cb_keyword
.
FormattingEnabled
=
true
;
this
.
cb_keyword
.
Location
=
new
System
.
Drawing
.
Point
(
664
,
371
);
this
.
cb_keyword
.
Location
=
new
System
.
Drawing
.
Point
(
757
,
432
);
this
.
cb_keyword
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
cb_keyword
.
Name
=
"cb_keyword"
;
this
.
cb_keyword
.
Size
=
new
System
.
Drawing
.
Size
(
176
,
23
);
this
.
cb_keyword
.
Size
=
new
System
.
Drawing
.
Size
(
233
,
23
);
this
.
cb_keyword
.
TabIndex
=
21
;
this
.
cb_keyword
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
cb_keyword_SelectedIndexChanged
);
//
// label5
//
this
.
label5
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
label5
.
AutoSize
=
true
;
this
.
label5
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
label5
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label5
.
Location
=
new
System
.
Drawing
.
Point
(
481
,
17
);
this
.
label5
.
Location
=
new
System
.
Drawing
.
Point
(
534
,
10
);
this
.
label5
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label5
.
Name
=
"label5"
;
this
.
label5
.
Size
=
new
System
.
Drawing
.
Size
(
64
,
16
);
this
.
label5
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
24
);
this
.
label5
.
TabIndex
=
25
;
this
.
label5
.
Text
=
"
Height
:"
;
this
.
label5
.
Text
=
"
高
:"
;
//
// label6
//
this
.
label6
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
label6
.
AutoSize
=
true
;
this
.
label6
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
label6
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label6
.
Location
=
new
System
.
Drawing
.
Point
(
303
,
17
);
this
.
label6
.
Location
=
new
System
.
Drawing
.
Point
(
316
,
9
);
this
.
label6
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label6
.
Name
=
"label6"
;
this
.
label6
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
16
);
this
.
label6
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
25
);
this
.
label6
.
TabIndex
=
24
;
this
.
label6
.
Text
=
"
Width
:"
;
this
.
label6
.
Text
=
"
宽
:"
;
//
// NumLabelH
//
this
.
NumLabelH
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
NumLabelH
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
NumLabelH
.
DecimalPlaces
=
2
;
this
.
NumLabelH
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
NumLabelH
.
Location
=
new
System
.
Drawing
.
Point
(
551
,
14
);
this
.
NumLabelH
.
Location
=
new
System
.
Drawing
.
Point
(
588
,
6
);
this
.
NumLabelH
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
NumLabelH
.
Minimum
=
new
decimal
(
new
int
[]
{
1
,
0
,
0
,
131072
});
this
.
NumLabelH
.
Name
=
"NumLabelH"
;
this
.
NumLabelH
.
Size
=
new
System
.
Drawing
.
Size
(
98
,
24
);
this
.
NumLabelH
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumLabelH
.
TabIndex
=
23
;
this
.
NumLabelH
.
Value
=
new
decimal
(
new
int
[]
{
1
,
...
...
@@ -400,17 +419,18 @@
//
// NumLabelW
//
this
.
NumLabelW
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)))
;
this
.
NumLabelW
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
NumLabelW
.
DecimalPlaces
=
2
;
this
.
NumLabelW
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
NumLabelW
.
Location
=
new
System
.
Drawing
.
Point
(
365
,
14
);
this
.
NumLabelW
.
Location
=
new
System
.
Drawing
.
Point
(
370
,
6
);
this
.
NumLabelW
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
NumLabelW
.
Minimum
=
new
decimal
(
new
int
[]
{
1
,
0
,
0
,
131072
});
this
.
NumLabelW
.
Name
=
"NumLabelW"
;
this
.
NumLabelW
.
Size
=
new
System
.
Drawing
.
Size
(
98
,
24
);
this
.
NumLabelW
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumLabelW
.
TabIndex
=
22
;
this
.
NumLabelW
.
Value
=
new
decimal
(
new
int
[]
{
1
,
...
...
@@ -421,19 +441,29 @@
//
// label_labelsize
//
this
.
label_labelsize
.
A
utoSize
=
true
;
this
.
label_labelsize
.
A
nchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
label_labelsize
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label_labelsize
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
17
);
this
.
label_labelsize
.
Location
=
new
System
.
Drawing
.
Point
(
166
,
10
);
this
.
label_labelsize
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label_labelsize
.
Name
=
"label_labelsize"
;
this
.
label_labelsize
.
Size
=
new
System
.
Drawing
.
Size
(
80
,
16
);
this
.
label_labelsize
.
Size
=
new
System
.
Drawing
.
Size
(
99
,
20
);
this
.
label_labelsize
.
TabIndex
=
26
;
this
.
label_labelsize
.
Text
=
"标签尺寸:"
;
//
// pictureBox1
//
this
.
pictureBox1
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
169
,
42
);
this
.
pictureBox1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
pictureBox1
.
Name
=
"pictureBox1"
;
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
563
,
633
);
this
.
pictureBox1
.
TabIndex
=
15
;
this
.
pictureBox1
.
TabStop
=
false
;
//
// FrmLabel
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1008
,
729
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1022
,
703
);
this
.
Controls
.
Add
(
this
.
label_labelsize
);
this
.
Controls
.
Add
(
this
.
label5
);
this
.
Controls
.
Add
(
this
.
label6
);
...
...
@@ -462,6 +492,7 @@
this
.
Controls
.
Add
(
this
.
BtnLabelNew
);
this
.
Controls
.
Add
(
this
.
LstLabelName
);
this
.
FormBorderStyle
=
System
.
Windows
.
Forms
.
FormBorderStyle
.
FixedSingle
;
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
Name
=
"FrmLabel"
;
this
.
ShowIcon
=
false
;
this
.
Text
=
"标签编辑"
;
...
...
@@ -471,10 +502,10 @@
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumY
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumW
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumH
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
this
.
groupBox1
.
ResumeLayout
(
false
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumLabelH
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
NumLabelW
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
...
...
@@ -497,7 +528,6 @@
private
System
.
Windows
.
Forms
.
NumericUpDown
NumW
;
private
System
.
Windows
.
Forms
.
NumericUpDown
NumH
;
private
System
.
Windows
.
Forms
.
TextBox
TxtFormatText
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
private
System
.
Windows
.
Forms
.
Label
label1
;
private
System
.
Windows
.
Forms
.
Label
label2
;
private
System
.
Windows
.
Forms
.
Label
label3
;
...
...
@@ -510,5 +540,6 @@
private
System
.
Windows
.
Forms
.
NumericUpDown
NumLabelH
;
private
System
.
Windows
.
Forms
.
NumericUpDown
NumLabelW
;
private
System
.
Windows
.
Forms
.
Label
label_labelsize
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
}
}
\ No newline at end of file
PrintLabel/FrmLabel.cs
查看文件 @
82b2f38
...
...
@@ -7,9 +7,11 @@ using System.Data;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Linq
;
using
System.Net.NetworkInformation
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
static
System
.
Net
.
Mime
.
MediaTypeNames
;
namespace
PrintLabel
{
...
...
@@ -304,7 +306,6 @@ namespace PrintLabel
private
void
NumLabelH_ValueChanged
(
object
sender
,
EventArgs
e
)
{
Common
.
LabelPrint
.
SetLabelSize
(
Convert
.
ToSingle
(
Common
.
Label
[
Common
.
LabelPrint
.
LabelIndex
].
Size_mm
.
Width
),
Convert
.
ToSingle
(
NumLabelH
.
Value
));
}
}
}
}
PrintLabel/PrintLabel.cs
查看文件 @
82b2f38
using
PrintLabel
;
using
Microsoft.VisualBasic.ApplicationServices
;
using
PrintLabel
;
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
...
...
@@ -10,6 +11,7 @@ using System.Runtime.InteropServices.ComTypes;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
static
System
.
Net
.
Mime
.
MediaTypeNames
;
namespace
Asa
...
...
@@ -248,7 +250,7 @@ namespace Asa
/// </summary>
/// <param name="key"></param>
/// <returns>是否打印成功</returns>
public
bool
PrintToTsc
(
Dictionary
<
string
,
string
>
key
,
out
TscStauts
tscStauts
)
public
bool
PrintToTsc
(
Dictionary
<
string
,
string
>
key
,
int
x
,
int
y
,
out
TscStauts
tscStauts
)
{
tscStauts
=
CheckTscStatus
();
if
(
tscStauts
!=
0
)
{
...
...
@@ -261,7 +263,7 @@ namespace Asa
Bitmap
bmp
=
null
;
try
{
bmp
=
PrintPreview
(
key
);
bmp
=
PrintPreview
(
key
);
var
mm
=
Common
.
PxToMM
(
bmp
.
Width
);
var
nn
=
Common
.
PxToMM
(
bmp
.
Height
);
TSCLIB_DLL
.
openport
(
"USB"
);
...
...
@@ -273,11 +275,11 @@ namespace Asa
SendCommand
(
"SET ENCODER OFF"
);
//碳带编码器检测
SendCommand
(
"OFFSET -10 mm"
);
//出纸偏移
SendCommand
(
"SPEED 9"
);
//速度最大15
SendCommand
(
"DENSITY 1
2
"
);
//浓度
SendCommand
(
"DENSITY 1
5
"
);
//浓度
SendCommand
(
"DIRECTION 1"
);
SendCommand
(
"SET PEEL OFF"
);
TSCLIB_DLL
.
clearbuffer
();
TSCLIB_DLL
.
sendpicture
(
0
,
0
,
bmp
);
TSCLIB_DLL
.
sendpicture
(
x
,
y
,
bmp
);
TSCLIB_DLL
.
printlabel
(
"1"
,
"1"
);
TSCLIB_DLL
.
closeport
();
Task
.
Delay
(
350
).
Wait
();
...
...
@@ -303,13 +305,15 @@ namespace Asa
Console
.
WriteLine
(
TSCLIB_DLL
.
sendcommand
(
command
));
}
Task
<
Bitmap
>
printt
;
/// <summary>
/// 打印
/// </summary>
/// <param name="key"></param>
/// <returns>是否打印成功</returns>
public
bool
PrintToTsc
1
(
Dictionary
<
string
,
string
>
key
,
TscConfig
tscConfig
,
out
TscStauts
tscStauts
)
public
bool
PrintToTsc
_New
(
Dictionary
<
string
,
string
>
key
,
TscConfig
tscConfig
,
out
TscStauts
tscStauts
,
out
Bitmap
bitmap
)
{
bitmap
=
null
;
tscStauts
=
CheckTscStatus
();
if
(
tscStauts
!=
0
)
{
...
...
@@ -317,12 +321,12 @@ namespace Asa
Console
.
WriteLine
(
$
"Error: {err}"
);
return
false
;
}
var
t
=
Task
.
Run
(()
=>
printt
=
Task
.
Run
(
new
Func
<
Bitmap
>
(()
=>
{
Bitmap
bmp
=
null
;
try
{
bmp
=
PrintPreview
(
key
);
bmp
=
PrintPreview
(
key
);
var
mm
=
Common
.
PxToMM
(
bmp
.
Width
);
var
nn
=
Common
.
PxToMM
(
bmp
.
Height
);
...
...
@@ -330,27 +334,102 @@ namespace Asa
TSCLIB_DLL
.
openport
(
tscConfig
.
PrinterName
);
TSCLIB_DLL
.
sendcommand
(
$
"SIZE {mm:0.00} mm, {nn:0.00} mm"
);
TSCLIB_DLL
.
sendcommand
(
$
"GAP {tscConfig.Gap} mm,{tscConfig.GapOffset} mm"
);
TSCLIB_DLL
.
sendcommand
(
"SET CUTTER ON"
);
TSCLIB_DLL
.
sendcommand
(
"SET RIBBON OFF"
);
//使用碳带
TSCLIB_DLL
.
sendcommand
(
"SET ENCODER OFF"
);
//碳带编码器检测
//TSCLIB_DLL.sendcommand("SET CUTTER OFF");//裁剪模式
//TSCLIB_DLL.sendcommand($"SET PEEL ON");//剥离模式
//TSCLIB_DLL.sendcommand("SET RIBBON ON"); //使用碳带
//TSCLIB_DLL.sendcommand("SET ENCODER OFF"); //碳带编码器检测
TSCLIB_DLL
.
sendcommand
(
$
"OFFSET {tscConfig.Offset} mm"
);
//出纸偏移
TSCLIB_DLL
.
sendcommand
(
$
"SPEED {tscConfig.Speed}"
);
//速度最大15
TSCLIB_DLL
.
sendcommand
(
$
"DENSITY {tscConfig.Density}"
);
//浓度最大15
TSCLIB_DLL
.
sendcommand
(
$
"DIRECTION {tscConfig.Direction}"
);
TSCLIB_DLL
.
sendcommand
(
"SET PEEL OFF"
);
TSCLIB_DLL
.
sendcommand
(
$
"DENSITY {tscConfig.Density}"
);
//浓度最大15
TSCLIB_DLL
.
sendcommand
(
$
"DIRECTION {tscConfig.Direction}"
);
TSCLIB_DLL
.
clearbuffer
();
TSCLIB_DLL
.
sendpicture
(
tscConfig
.
x
,
tscConfig
.
y
,
bmp
);
TSCLIB_DLL
.
printlabel
(
"1"
,
"1"
);
TSCLIB_DLL
.
closeport
();
//Task.Delay(350).Wait();
//bmp.Save(System.Windows.Forms.Application.StartupPath + $"\\PrintImage\\{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-ffff")}.jpg");
return
bmp
;
}
catch
(
Exception
e
)
{
return
bmp
;
}
finally
{
//bmp?.Dispose();
}
}));
tscStauts
=
CheckTscStatus
();
Console
.
WriteLine
(
"After print:"
+
tscStauts
);
Task
.
Delay
(
500
).
Wait
();
if
(
printt
.
IsCompleted
)
{
bitmap
=
printt
.
Result
;
}
if
(
tscStauts
==
TscStauts
.
打印中
||
tscStauts
==
TscStauts
.
准备就绪
||
tscStauts
==
TscStauts
.
None
)
{
return
true
;
}
else
{
return
false
;
}
//Console.WriteLine("usbportqueryprinter:" + TSCLIB_DLL.usbportqueryprinter());
}
/// <summary>
/// X400机器使用此打印方法
/// </summary>
/// <param name="key"></param>
/// <param name="tscConfig"></param>
/// <param name="tscStauts"></param>
/// <returns></returns>
public
bool
PrintToTsc_X400
(
Dictionary
<
string
,
string
>
key
,
TscConfig
tscConfig
,
out
TscStauts
tscStauts
)
{
tscStauts
=
CheckTscStatus
();
if
(
tscStauts
!=
0
)
{
var
err
=
(
TscStauts
)
tscStauts
;
Console
.
WriteLine
(
$
"Error: {err}"
);
return
false
;
}
Task
.
Run
(()
=>
{
Bitmap
bmp
=
null
;
try
{
bmp
=
PrintPreview
(
key
);
var
mm
=
Common
.
PxToMM
(
bmp
.
Width
);
var
nn
=
Common
.
PxToMM
(
bmp
.
Height
);
TSCSDK
.
driver
TSCLIB_DLL
=
new
TSCSDK
.
driver
();
TSCLIB_DLL
.
openport
(
tscConfig
.
PrinterName
);
TSCLIB_DLL
.
sendcommand
(
$
"SIZE {mm:0.00} mm, {nn:0.00} mm"
);
TSCLIB_DLL
.
sendcommand
(
$
"GAP {tscConfig.Gap} mm,{tscConfig.GapOffset} mm"
);
//默认值2 0
TSCLIB_DLL
.
sendcommand
(
$
"SPEED {tscConfig.Speed}"
);
//速度
TSCLIB_DLL
.
sendcommand
(
$
"DENSITY {tscConfig.Density}"
);
//浓度最大15
TSCLIB_DLL
.
sendcommand
(
"SET RIBBON OFF"
);
TSCLIB_DLL
.
sendcommand
(
$
"DIRECTION {tscConfig.Direction},{tscConfig.Directions}"
);
//默认值为1,0
TSCLIB_DLL
.
sendcommand
(
"REFERENCE 0,0"
);
TSCLIB_DLL
.
sendcommand
(
$
"OFFSET {tscConfig.Offset} mm"
);
//出纸偏移
TSCLIB_DLL
.
sendcommand
(
"SET STRIPER OFF"
);
//撕纸状态
TSCLIB_DLL
.
sendcommand
(
"SET CUTTER OFF"
);
TSCLIB_DLL
.
sendcommand
(
"SET PEEL ON"
);
//剥纸模式
TSCLIB_DLL
.
clearbuffer
();
TSCLIB_DLL
.
sendpicture
(
0
,
0
,
bmp
);
TSCLIB_DLL
.
sendpicture
(
tscConfig
.
x
,
tscConfig
.
y
,
bmp
);
TSCLIB_DLL
.
printlabel
(
"1"
,
"1"
);
TSCLIB_DLL
.
closeport
();
Task
.
Delay
(
350
).
Wait
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
)
{
}
finally
{
bmp
?.
Dispose
();
}
});
t
.
Wait
(
1000
);
tscStauts
=
CheckTscStatus
();
Console
.
WriteLine
(
"After print:"
+
tscStauts
);
if
(
tscStauts
==
TscStauts
.
打印中
||
tscStauts
==
TscStauts
.
准备就绪
||
tscStauts
==
TscStauts
.
None
)
...
...
@@ -362,9 +441,53 @@ namespace Asa
//Console.WriteLine("usbportqueryprinter:" + TSCLIB_DLL.usbportqueryprinter());
}
public
TscStauts
CheckTscStatus
()
{
/// <summary>
/// 完整的打印逻辑
/// </summary>
/// <param name="key"></param>
/// <param name="tscConfig"></param>
/// <param name="tscStauts"></param>
/// <returns></returns>
public
bool
PrintToTsc_X6
(
Dictionary
<
string
,
string
>
key
,
TscConfig
tscConfig
,
out
TscStauts
tscStauts
)
{
Bitmap
bmp
=
null
;
try
{
bmp
=
PrintPreview
(
key
);
var
mm
=
Common
.
PxToMM
(
bmp
.
Width
);
var
nn
=
Common
.
PxToMM
(
bmp
.
Height
);
TSCSDK
.
driver
TSCLIB_DLL
=
new
TSCSDK
.
driver
();
TSCLIB_DLL
.
openport
(
tscConfig
.
PrinterName
);
TSCLIB_DLL
.
sendcommand
(
$
"SIZE 59.9 mm, 39.9 mm"
);
TSCLIB_DLL
.
sendcommand
(
$
"GAP 2 mm,0 mm"
);
TSCLIB_DLL
.
sendcommand
(
$
"SPEED 11"
);
//速度
TSCLIB_DLL
.
sendcommand
(
$
"DENSITY 15"
);
//浓度最大15
TSCLIB_DLL
.
sendcommand
(
"SET RIBBON OFF"
);
TSCLIB_DLL
.
sendcommand
(
$
"DIRECTION 1,0"
);
TSCLIB_DLL
.
sendcommand
(
"REFERENCE 0,0"
);
TSCLIB_DLL
.
sendcommand
(
$
"OFFSET 10 mm"
);
//出纸偏移
TSCLIB_DLL
.
sendcommand
(
"SET STRIPER ON"
);
TSCLIB_DLL
.
sendcommand
(
"SET CUTTER OFF"
);
//TSCLIB_DLL.sendcommand("SET PEEL ON");
TSCLIB_DLL
.
clearbuffer
();
TSCLIB_DLL
.
sendpicture
(
tscConfig
.
x
,
tscConfig
.
y
,
bmp
);
TSCLIB_DLL
.
printlabel
(
"1"
,
"1"
);
TSCLIB_DLL
.
closeport
();
Task
.
Delay
(
350
).
Wait
();
}
catch
(
Exception
)
{
}
finally
{
bmp
?.
Dispose
();
}
tscStauts
=
TscStauts
.
打印中
;
return
true
;
//Console.WriteLine("usbportqueryprinter:" + TSCLIB_DLL.usbportqueryprinter());
}
TscStauts
CheckTscStatus
()
{
//return TscStauts.准备就绪;
TscStauts
s
=
TscStauts
.
None
;
var
t
=
Task
.
Run
(()
=>
{
Console
.
WriteLine
(
"TID:"
+
GetCurrentThreadId
().
ToString
(
"X"
));
...
...
@@ -415,8 +538,8 @@ namespace Asa
b
=
1
<<
1
,
c
=
1
<<
2
,
}
public
class
TscConfig
{
public
class
TscConfig
{
/// <summary>
/// 打印机名称
/// </summary>
...
...
@@ -433,6 +556,7 @@ namespace Asa
/// 打印方向 1横向,0纵向,默认1
/// </summary>
public
int
Direction
=
1
;
public
int
Directions
=
0
;
/// <summary>
/// 出纸偏移量mm,默认-10mm
/// </summary>
...
...
@@ -445,6 +569,15 @@ namespace Asa
/// 打印浓度 1-15,默认12
/// </summary>
public
int
Density
=
12
;
/// <summary>
/// 打印x轴偏移量
/// </summary>
public
int
x
=
0
;
/// <summary>
/// 打印y轴偏移量
/// </summary>
public
int
y
=
0
;
}
}
PrintLabel/PrintLabel.csproj
查看文件 @
82b2f38
...
...
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Asa</RootNamespace>
<AssemblyName>Asa.PrintLabel</AssemblyName>
<TargetFrameworkVersion>v4.
6
.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
7
.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
...
...
PrintLabel/packages.config
查看文件 @
82b2f38
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"ZXing.Net"
version
=
"0.16.9"
targetFramework
=
"net462"
/>
<
package
id
=
"ZXing.Net"
version
=
"0.16.9"
targetFramework
=
"net462"
requireReinstallation
=
"true"
/>
</
packages
>
\ No newline at end of file
PrintLabel_Test/App.config
查看文件 @
82b2f38
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
7.1
"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
8
"
/>
</
startup
>
</
configuration
>
PrintLabel_Test/Form1.Designer.cs
查看文件 @
82b2f38
...
...
@@ -39,14 +39,17 @@
this
.
btn_tsc
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
cb_labelname
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
advanceConfigEdit1
=
new
ConfigHelper
.
AdvanceConfigEdit
();
this
.
button7
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button10
=
new
System
.
Windows
.
Forms
.
Button
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
BeginInit
();
this
.
SuspendLayout
();
//
// button1
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
142
,
68
);
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
13
);
this
.
button1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
49
);
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
74
);
this
.
button1
.
TabIndex
=
0
;
this
.
button1
.
Text
=
"编辑"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -54,17 +57,19 @@
//
// textBox1
//
this
.
textBox1
.
Location
=
new
System
.
Drawing
.
Point
(
362
,
68
);
this
.
textBox1
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
14
);
this
.
textBox1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
textBox1
.
Name
=
"textBox1"
;
this
.
textBox1
.
Size
=
new
System
.
Drawing
.
Size
(
162
,
21
);
this
.
textBox1
.
Size
=
new
System
.
Drawing
.
Size
(
241
,
28
);
this
.
textBox1
.
TabIndex
=
1
;
this
.
textBox1
.
Text
=
"test2"
;
//
// button2
//
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
362
,
122
);
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
102
);
this
.
button2
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
1
00
,
23
);
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
1
50
,
34
);
this
.
button2
.
TabIndex
=
2
;
this
.
button2
.
Text
=
"加载"
;
this
.
button2
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -72,9 +77,10 @@
//
// button3
//
this
.
button3
.
Location
=
new
System
.
Drawing
.
Point
(
142
,
123
);
this
.
button3
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
102
);
this
.
button3
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button3
.
Name
=
"button3"
;
this
.
button3
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
49
);
this
.
button3
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
74
);
this
.
button3
.
TabIndex
=
3
;
this
.
button3
.
Text
=
"打印"
;
this
.
button3
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -82,17 +88,19 @@
//
// textBox2
//
this
.
textBox2
.
Location
=
new
System
.
Drawing
.
Point
(
362
,
95
);
this
.
textBox2
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
59
);
this
.
textBox2
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
textBox2
.
Name
=
"textBox2"
;
this
.
textBox2
.
Size
=
new
System
.
Drawing
.
Size
(
162
,
21
);
this
.
textBox2
.
Size
=
new
System
.
Drawing
.
Size
(
241
,
28
);
this
.
textBox2
.
TabIndex
=
4
;
this
.
textBox2
.
Text
=
"ZDesigner GT800 (EPL)"
;
//
// button4
//
this
.
button4
.
Location
=
new
System
.
Drawing
.
Point
(
362
,
217
);
this
.
button4
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
144
);
this
.
button4
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button4
.
Name
=
"button4"
;
this
.
button4
.
Size
=
new
System
.
Drawing
.
Size
(
1
00
,
23
);
this
.
button4
.
Size
=
new
System
.
Drawing
.
Size
(
1
50
,
34
);
this
.
button4
.
TabIndex
=
5
;
this
.
button4
.
Text
=
"获取状态"
;
this
.
button4
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -100,17 +108,19 @@
//
// pictureBox1
//
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
509
,
123
);
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
456
,
426
);
this
.
pictureBox1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
pictureBox1
.
Name
=
"pictureBox1"
;
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
251
,
163
);
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
376
,
244
);
this
.
pictureBox1
.
TabIndex
=
6
;
this
.
pictureBox1
.
TabStop
=
false
;
//
// button5
//
this
.
button5
.
Location
=
new
System
.
Drawing
.
Point
(
142
,
178
);
this
.
button5
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
188
);
this
.
button5
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button5
.
Name
=
"button5"
;
this
.
button5
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
47
);
this
.
button5
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
70
);
this
.
button5
.
TabIndex
=
7
;
this
.
button5
.
Text
=
"button5"
;
this
.
button5
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -118,9 +128,10 @@
//
// btn_tsc
//
this
.
btn_tsc
.
Location
=
new
System
.
Drawing
.
Point
(
82
,
377
);
this
.
btn_tsc
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
437
);
this
.
btn_tsc
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
btn_tsc
.
Name
=
"btn_tsc"
;
this
.
btn_tsc
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
42
);
this
.
btn_tsc
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
63
);
this
.
btn_tsc
.
TabIndex
=
8
;
this
.
btn_tsc
.
Text
=
"TSC Print"
;
this
.
btn_tsc
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -129,23 +140,49 @@
// cb_labelname
//
this
.
cb_labelname
.
FormattingEnabled
=
true
;
this
.
cb_labelname
.
Location
=
new
System
.
Drawing
.
Point
(
82
,
351
);
this
.
cb_labelname
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
378
);
this
.
cb_labelname
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
cb_labelname
.
Name
=
"cb_labelname"
;
this
.
cb_labelname
.
Size
=
new
System
.
Drawing
.
Size
(
160
,
20
);
this
.
cb_labelname
.
Size
=
new
System
.
Drawing
.
Size
(
238
,
26
);
this
.
cb_labelname
.
TabIndex
=
9
;
//
// advanceConfigEdit1
//
this
.
advanceConfigEdit1
.
Location
=
new
System
.
Drawing
.
Point
(
283
,
303
);
this
.
advanceConfigEdit1
.
Location
=
new
System
.
Drawing
.
Point
(
456
,
13
);
this
.
advanceConfigEdit1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
);
this
.
advanceConfigEdit1
.
Name
=
"advanceConfigEdit1"
;
this
.
advanceConfigEdit1
.
Size
=
new
System
.
Drawing
.
Size
(
404
,
273
);
this
.
advanceConfigEdit1
.
Size
=
new
System
.
Drawing
.
Size
(
655
,
391
);
this
.
advanceConfigEdit1
.
TabIndex
=
10
;
//
// button7
//
this
.
button7
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
508
);
this
.
button7
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button7
.
Name
=
"button7"
;
this
.
button7
.
Size
=
new
System
.
Drawing
.
Size
(
184
,
63
);
this
.
button7
.
TabIndex
=
12
;
this
.
button7
.
Text
=
"X400"
;
this
.
button7
.
UseVisualStyleBackColor
=
true
;
this
.
button7
.
Click
+=
new
System
.
EventHandler
(
this
.
button7_Click
);
//
// button10
//
this
.
button10
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
588
);
this
.
button10
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button10
.
Name
=
"button10"
;
this
.
button10
.
Size
=
new
System
.
Drawing
.
Size
(
184
,
63
);
this
.
button10
.
TabIndex
=
15
;
this
.
button10
.
Text
=
"X6"
;
this
.
button10
.
UseVisualStyleBackColor
=
true
;
this
.
button10
.
Click
+=
new
System
.
EventHandler
(
this
.
button10_Click
);
//
// Form1
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12
F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
9F
,
18
F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
885
,
588
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1366
,
911
);
this
.
Controls
.
Add
(
this
.
button10
);
this
.
Controls
.
Add
(
this
.
button7
);
this
.
Controls
.
Add
(
this
.
advanceConfigEdit1
);
this
.
Controls
.
Add
(
this
.
cb_labelname
);
this
.
Controls
.
Add
(
this
.
btn_tsc
);
...
...
@@ -157,6 +194,7 @@
this
.
Controls
.
Add
(
this
.
button2
);
this
.
Controls
.
Add
(
this
.
textBox1
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
Name
=
"Form1"
;
this
.
StartPosition
=
System
.
Windows
.
Forms
.
FormStartPosition
.
CenterScreen
;
this
.
Text
=
"Form1"
;
...
...
@@ -180,6 +218,8 @@
private
System
.
Windows
.
Forms
.
Button
btn_tsc
;
private
System
.
Windows
.
Forms
.
ComboBox
cb_labelname
;
private
ConfigHelper
.
AdvanceConfigEdit
advanceConfigEdit1
;
private
System
.
Windows
.
Forms
.
Button
button7
;
private
System
.
Windows
.
Forms
.
Button
button10
;
}
}
PrintLabel_Test/Form1.cs
查看文件 @
82b2f38
...
...
@@ -81,7 +81,11 @@ namespace PrintLabel_Test
tscConfig
.
Offset
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Offset"
,
-
17D
);
tscConfig
.
Speed
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Speed"
,
9
);
tscConfig
.
Density
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Density"
,
12
);
print
.
PrintToTsc1
(
text
,
tscConfig
,
out
TscStauts
tscStauts
);
tscConfig
.
x
=
ConfigHelper
.
Config
.
Get
(
"Tsc_x"
,
9
);
tscConfig
.
y
=
ConfigHelper
.
Config
.
Get
(
"Tsc_y"
,
12
);
tscConfig
.
Gap
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Gap"
,
3
);
tscConfig
.
GapOffset
=
ConfigHelper
.
Config
.
Get
(
"Tsc_GapOffset"
,
0.3
);
print
.
PrintToTsc_New
(
text
,
tscConfig
,
out
TscStauts
tscStauts
,
out
Bitmap
bmp
);
return
;
}
...
...
@@ -92,5 +96,43 @@ namespace PrintLabel_Test
if
(
cb_labelname
.
Items
.
Count
>
0
)
cb_labelname
.
SelectedIndex
=
0
;
}
private
void
button7_Click
(
object
sender
,
EventArgs
e
)
{
Dictionary
<
string
,
string
>
text
=
new
Dictionary
<
string
,
string
>();
text
.
Add
(
"ri"
,
"123123123123123"
);
text
.
Add
(
"pn"
,
"yumtr3123123j"
);
Dictionary
<
string
,
string
>
keys
=
new
Dictionary
<
string
,
string
>();
//TSCLIB_DLL.sendcommand("HOME");
print
.
SetResolution
(
300
);
print
.
GetLabelName
();
print
.
LoadLabel
(
cb_labelname
.
SelectedItem
.
ToString
());
TscConfig
tscConfig
=
new
TscConfig
();
tscConfig
.
Offset
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Offset"
,
-
17D
);
tscConfig
.
Speed
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Speed"
,
9
);
tscConfig
.
Density
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Density"
,
12
);
tscConfig
.
GapOffset
=
ConfigHelper
.
Config
.
Get
(
"Tsc_GapOffset"
,
0
);
tscConfig
.
Gap
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Gap"
,
0
);
print
.
PrintToTsc_X400
(
keys
,
tscConfig
,
out
TscStauts
tscStauts
);
}
private
void
button10_Click
(
object
sender
,
EventArgs
e
)
{
Dictionary
<
string
,
string
>
text
=
new
Dictionary
<
string
,
string
>();
text
.
Add
(
"ri"
,
"666"
);
text
.
Add
(
"pn"
,
"777"
);
Dictionary
<
string
,
string
>
keys
=
new
Dictionary
<
string
,
string
>();
//TSCLIB_DLL.sendcommand("HOME");
print
.
SetResolution
(
300
);
print
.
GetLabelName
();
print
.
LoadLabel
(
cb_labelname
.
SelectedItem
.
ToString
());
TscConfig
tscConfig
=
new
TscConfig
();
tscConfig
.
Offset
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Offset"
,
-
17D
);
tscConfig
.
Speed
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Speed"
,
9
);
tscConfig
.
Density
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Density"
,
12
);
tscConfig
.
GapOffset
=
ConfigHelper
.
Config
.
Get
(
"Tsc_GapOffset"
,
0
);
tscConfig
.
Directions
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Directions"
,
1
);
print
.
PrintToTsc_X6
(
keys
,
tscConfig
,
out
TscStauts
tscStauts
);
}
}
}
PrintLabel_Test/PrintLabel_Test.csproj
查看文件 @
82b2f38
...
...
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>PrintLabel_Test</RootNamespace>
<AssemblyName>PrintLabel_Test</AssemblyName>
<TargetFrameworkVersion>v4.
7.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
...
...
@@ -36,7 +36,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="ConfigHelper">
<HintPath>..\..\
ConfigHelper\ConfigHelper\bin\Debug
\ConfigHelper.dll</HintPath>
<HintPath>..\..\
..\类库
\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="SdkApi.Desktop, Version=2.15.2634.0, Culture=neutral, processorArchitecture=MSIL">
...
...
@@ -54,6 +54,10 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="ZebraPrinterHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\ZebraPrinterHelper.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
...
...
@@ -104,10 +108,6 @@
<Project>{b8f25ece-dee6-41d6-8ef0-8afbf2577c17}</Project>
<Name>PrintLabel</Name>
</ProjectReference>
<ProjectReference Include="..\ZebraPrinterHelper\ZebraPrinterHelper.csproj">
<Project>{e4f7afc7-2f6d-4685-8350-3c05697428ea}</Project>
<Name>ZebraPrinterHelper</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
PrintLabel_Test/Properties/Resources.Designer.cs
查看文件 @
82b2f38
...
...
@@ -19,7 +19,7 @@ namespace PrintLabel_Test.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"1
6
.0.0.0"
)]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"1
7
.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
Resources
{
...
...
PrintLabel_Test/Properties/Settings.Designer.cs
查看文件 @
82b2f38
...
...
@@ -12,7 +12,7 @@ namespace PrintLabel_Test.Properties {
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"1
6.10
.0.0"
)]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"1
7.8
.0.0"
)]
internal
sealed
partial
class
Settings
:
global
::
System
.
Configuration
.
ApplicationSettingsBase
{
private
static
Settings
defaultInstance
=
((
Settings
)(
global
::
System
.
Configuration
.
ApplicationSettingsBase
.
Synchronized
(
new
Settings
())));
...
...
ZebraDemoSource/App.config
查看文件 @
82b2f38
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
7.1"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
8"
/>
</
startup
>
</
configuration
>
ZebraDemoSource/DeveloperDemo_Windows.csproj
查看文件 @
82b2f38
...
...
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Zebra.Windows.DevDemo</RootNamespace>
<AssemblyName>DeveloperDemo.Windows</AssemblyName>
<TargetFrameworkVersion>v4.
7.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
...
...
ZebraDemoSource/Properties/Resources.Designer.cs
查看文件 @
82b2f38
//------------------------------------------------------------------------------
// <auto-generated>
//
This code was generated by a tool.
//
Runtime Version
:4.0.30319.42000
//
此代码由工具生成。
//
运行时版本
:4.0.30319.42000
//
//
Changes to this file may cause incorrect behavior and will be lost if
//
the code is regenerated.
//
对此文件的更改可能会导致不正确的行为,并且如果
//
重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
...
...
@@ -13,13 +13,13 @@ namespace Zebra.Windows.DevDemo.Properties {
/// <summary>
///
A strongly-typed resource class, for looking up localized strings, etc.
///
一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
//
This class was auto-generated by the
StronglyTypedResourceBuilder
//
class via a tool like ResGen or Visual Studio.
//
To add or remove a member, edit your .ResX file then rerun
ResGen
//
with the /str option, or rebuild your VS project.
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"1
5
.0.0.0"
)]
//
此类是由
StronglyTypedResourceBuilder
//
类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
//
若要添加或移除成员,请编辑 .ResX 文件,然后重新运行
ResGen
//
(以 /str 作为命令选项),或重新生成 VS 项目。
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"1
7
.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
Resources
{
...
...
@@ -33,7 +33,7 @@ namespace Zebra.Windows.DevDemo.Properties {
}
/// <summary>
///
Returns the cached ResourceManager instance used by this class.
///
返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
...
...
@@ -47,8 +47,8 @@ namespace Zebra.Windows.DevDemo.Properties {
}
/// <summary>
///
Overrides the current thread's CurrentUICulture property for all
///
resource lookups using this strongly typed resource class.
///
重写当前线程的 CurrentUICulture 属性,对
///
使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Globalization
.
CultureInfo
Culture
{
...
...
ZebraDemoSource/Properties/Settings.Designer.cs
查看文件 @
82b2f38
//------------------------------------------------------------------------------
// <auto-generated>
//
This code was generated by a tool.
//
Runtime Version
:4.0.30319.42000
//
此代码由工具生成。
//
运行时版本
:4.0.30319.42000
//
//
Changes to this file may cause incorrect behavior and will be lost if
//
the code is regenerated.
//
对此文件的更改可能会导致不正确的行为,并且如果
//
重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
...
...
@@ -12,7 +12,7 @@ namespace Zebra.Windows.DevDemo.Properties {
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"1
5
.6.0.0"
)]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"1
7
.6.0.0"
)]
internal
sealed
partial
class
Settings
:
global
::
System
.
Configuration
.
ApplicationSettingsBase
{
private
static
Settings
defaultInstance
=
((
Settings
)(
global
::
System
.
Configuration
.
ApplicationSettingsBase
.
Synchronized
(
new
Settings
())));
...
...
ZebraPrinterHelper/App.config
查看文件 @
82b2f38
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
7.1
"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
8
"
/>
</
startup
>
</
configuration
>
ZebraPrinterHelper/ZebraPrinterHelper.csproj
查看文件 @
82b2f38
...
...
@@ -8,7 +8,7 @@
<OutputType>Library</OutputType>
<RootNamespace>ZebraPrinterHelper</RootNamespace>
<AssemblyName>ZebraPrinterHelper</AssemblyName>
<TargetFrameworkVersion>v4.
7.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论