Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
PrintLabel
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 463738c6
由
刘韬
编写于
2025-03-17 17:09:51 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
68f397be
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
157 行增加
和
57 行删除
PrintLabel/FrmLabel.Designer.cs
PrintLabel/PrintLabel.cs
PrintLabel_Test/Form1.Designer.cs
PrintLabel_Test/Form1.cs
PrintLabel/FrmLabel.Designer.cs
查看文件 @
463738c
...
@@ -212,6 +212,7 @@
...
@@ -212,6 +212,7 @@
this
.
NumX
.
Name
=
"NumX"
;
this
.
NumX
.
Name
=
"NumX"
;
this
.
NumX
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumX
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumX
.
TabIndex
=
10
;
this
.
NumX
.
TabIndex
=
10
;
this
.
NumX
.
Tag
=
"not"
;
this
.
NumX
.
ValueChanged
+=
new
System
.
EventHandler
(
this
.
NumX_ValueChanged
);
this
.
NumX
.
ValueChanged
+=
new
System
.
EventHandler
(
this
.
NumX_ValueChanged
);
//
//
// NumY
// NumY
...
@@ -229,6 +230,7 @@
...
@@ -229,6 +230,7 @@
this
.
NumY
.
Name
=
"NumY"
;
this
.
NumY
.
Name
=
"NumY"
;
this
.
NumY
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumY
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumY
.
TabIndex
=
11
;
this
.
NumY
.
TabIndex
=
11
;
this
.
NumY
.
Tag
=
"not"
;
this
.
NumY
.
ValueChanged
+=
new
System
.
EventHandler
(
this
.
NumY_ValueChanged
);
this
.
NumY
.
ValueChanged
+=
new
System
.
EventHandler
(
this
.
NumY_ValueChanged
);
//
//
// NumW
// NumW
...
@@ -246,6 +248,7 @@
...
@@ -246,6 +248,7 @@
this
.
NumW
.
Name
=
"NumW"
;
this
.
NumW
.
Name
=
"NumW"
;
this
.
NumW
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumW
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumW
.
TabIndex
=
12
;
this
.
NumW
.
TabIndex
=
12
;
this
.
NumW
.
Tag
=
"not"
;
this
.
NumW
.
Value
=
new
decimal
(
new
int
[]
{
this
.
NumW
.
Value
=
new
decimal
(
new
int
[]
{
1
,
1
,
0
,
0
,
...
@@ -268,6 +271,7 @@
...
@@ -268,6 +271,7 @@
this
.
NumH
.
Name
=
"NumH"
;
this
.
NumH
.
Name
=
"NumH"
;
this
.
NumH
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumH
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumH
.
TabIndex
=
13
;
this
.
NumH
.
TabIndex
=
13
;
this
.
NumH
.
Tag
=
"not"
;
this
.
NumH
.
Value
=
new
decimal
(
new
int
[]
{
this
.
NumH
.
Value
=
new
decimal
(
new
int
[]
{
1
,
1
,
0
,
0
,
...
@@ -286,6 +290,7 @@
...
@@ -286,6 +290,7 @@
this
.
TxtFormatText
.
ScrollBars
=
System
.
Windows
.
Forms
.
ScrollBars
.
Both
;
this
.
TxtFormatText
.
ScrollBars
=
System
.
Windows
.
Forms
.
ScrollBars
.
Both
;
this
.
TxtFormatText
.
Size
=
new
System
.
Drawing
.
Size
(
234
,
122
);
this
.
TxtFormatText
.
Size
=
new
System
.
Drawing
.
Size
(
234
,
122
);
this
.
TxtFormatText
.
TabIndex
=
14
;
this
.
TxtFormatText
.
TabIndex
=
14
;
this
.
TxtFormatText
.
Tag
=
"not"
;
this
.
TxtFormatText
.
TextChanged
+=
new
System
.
EventHandler
(
this
.
TxtFormatText_TextChanged
);
this
.
TxtFormatText
.
TextChanged
+=
new
System
.
EventHandler
(
this
.
TxtFormatText_TextChanged
);
//
//
// label1
// label1
...
@@ -377,23 +382,25 @@
...
@@ -377,23 +382,25 @@
//
//
this
.
label5
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
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
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label5
.
Location
=
new
System
.
Drawing
.
Point
(
5
34
,
10
);
this
.
label5
.
Location
=
new
System
.
Drawing
.
Point
(
5
09
,
10
);
this
.
label5
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label5
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label5
.
Name
=
"label5"
;
this
.
label5
.
Name
=
"label5"
;
this
.
label5
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
24
);
this
.
label5
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
24
);
this
.
label5
.
TabIndex
=
25
;
this
.
label5
.
TabIndex
=
25
;
this
.
label5
.
Text
=
"高:"
;
this
.
label5
.
Text
=
"高:"
;
this
.
label5
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
TopRight
;
//
//
// label6
// label6
//
//
this
.
label6
.
Anchor
=
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
;
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
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label6
.
Location
=
new
System
.
Drawing
.
Point
(
316
,
9
);
this
.
label6
.
Location
=
new
System
.
Drawing
.
Point
(
293
,
9
);
this
.
label6
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label6
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
label6
.
Name
=
"label6"
;
this
.
label6
.
Name
=
"label6"
;
this
.
label6
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
25
);
this
.
label6
.
Size
=
new
System
.
Drawing
.
Size
(
69
,
25
);
this
.
label6
.
TabIndex
=
24
;
this
.
label6
.
TabIndex
=
24
;
this
.
label6
.
Text
=
"宽:"
;
this
.
label6
.
Text
=
"宽:"
;
this
.
label6
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
TopRight
;
//
//
// NumLabelH
// NumLabelH
//
//
...
@@ -410,6 +417,7 @@
...
@@ -410,6 +417,7 @@
this
.
NumLabelH
.
Name
=
"NumLabelH"
;
this
.
NumLabelH
.
Name
=
"NumLabelH"
;
this
.
NumLabelH
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumLabelH
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumLabelH
.
TabIndex
=
23
;
this
.
NumLabelH
.
TabIndex
=
23
;
this
.
NumLabelH
.
Tag
=
"not"
;
this
.
NumLabelH
.
Value
=
new
decimal
(
new
int
[]
{
this
.
NumLabelH
.
Value
=
new
decimal
(
new
int
[]
{
1
,
1
,
0
,
0
,
...
@@ -432,6 +440,7 @@
...
@@ -432,6 +440,7 @@
this
.
NumLabelW
.
Name
=
"NumLabelW"
;
this
.
NumLabelW
.
Name
=
"NumLabelW"
;
this
.
NumLabelW
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumLabelW
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
24
);
this
.
NumLabelW
.
TabIndex
=
22
;
this
.
NumLabelW
.
TabIndex
=
22
;
this
.
NumLabelW
.
Tag
=
"not"
;
this
.
NumLabelW
.
Value
=
new
decimal
(
new
int
[]
{
this
.
NumLabelW
.
Value
=
new
decimal
(
new
int
[]
{
1
,
1
,
0
,
0
,
...
@@ -517,7 +526,6 @@
...
@@ -517,7 +526,6 @@
private
System
.
Windows
.
Forms
.
Button
BtnLabelNew
;
private
System
.
Windows
.
Forms
.
Button
BtnLabelNew
;
private
System
.
Windows
.
Forms
.
Button
BtnLabelDel
;
private
System
.
Windows
.
Forms
.
Button
BtnLabelDel
;
private
System
.
Windows
.
Forms
.
Button
BtnRename
;
private
System
.
Windows
.
Forms
.
Button
BtnRename
;
private
System
.
Windows
.
Forms
.
Button
BtnPrintTest
;
private
System
.
Windows
.
Forms
.
Button
BtnSave
;
private
System
.
Windows
.
Forms
.
Button
BtnSave
;
private
System
.
Windows
.
Forms
.
Button
BtnFieldAdd
;
private
System
.
Windows
.
Forms
.
Button
BtnFieldAdd
;
private
System
.
Windows
.
Forms
.
Button
BtnFieldDel
;
private
System
.
Windows
.
Forms
.
Button
BtnFieldDel
;
...
@@ -541,5 +549,6 @@
...
@@ -541,5 +549,6 @@
private
System
.
Windows
.
Forms
.
NumericUpDown
NumLabelW
;
private
System
.
Windows
.
Forms
.
NumericUpDown
NumLabelW
;
private
System
.
Windows
.
Forms
.
Label
label_labelsize
;
private
System
.
Windows
.
Forms
.
Label
label_labelsize
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
public
System
.
Windows
.
Forms
.
Button
BtnPrintTest
;
}
}
}
}
\ No newline at end of file
\ No newline at end of file
PrintLabel/PrintLabel.cs
查看文件 @
463738c
...
@@ -3,6 +3,7 @@ using PrintLabel;
...
@@ -3,6 +3,7 @@ using PrintLabel;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Drawing
;
using
System.IO
;
using
System.Management
;
using
System.Management
;
using
System.Net.NetworkInformation
;
using
System.Net.NetworkInformation
;
using
System.Printing
;
using
System.Printing
;
...
@@ -327,21 +328,23 @@ namespace Asa
...
@@ -327,21 +328,23 @@ namespace Asa
try
try
{
{
bmp
=
PrintPreview
(
key
);
bmp
=
PrintPreview
(
key
);
bmp
.
Save
(
Path
.
Combine
(
System
.
Windows
.
Forms
.
Application
.
StartupPath
,
"label.bmp"
));
var
mm
=
Common
.
PxToMM
(
bmp
.
Width
);
var
mm
=
Common
.
PxToMM
(
bmp
.
Width
);
var
nn
=
Common
.
PxToMM
(
bmp
.
Height
);
var
nn
=
Common
.
PxToMM
(
bmp
.
Height
);
TSCSDK
.
driver
TSCLIB_DLL
=
new
TSCSDK
.
driver
();
TSCSDK
.
driver
TSCLIB_DLL
=
new
TSCSDK
.
driver
();
TSCLIB_DLL
.
openport
(
tscConfig
.
PrinterName
);
TSCLIB_DLL
.
openport
(
tscConfig
.
PrinterName
);
TSCLIB_DLL
.
sendcommand
(
$
"SIZE {mm:0.00} mm, {nn:0.00} mm"
);
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($"GAP {tscConfig.Gap} mm,{tscConfig.GapOffset} mm");
//TSCLIB_DLL.sendcommand("SET STRIPER ON");//撕纸状态
//TSCLIB_DLL.sendcommand("SET CUTTER OFF");//裁剪模式
//TSCLIB_DLL.sendcommand("SET CUTTER OFF");//裁剪模式
//TSCLIB_DLL.sendcommand(
$"SET PEEL ON
");//剥离模式
//TSCLIB_DLL.sendcommand(
"SET PEEL OFF
");//剥离模式
//TSCLIB_DLL.sendcommand("SET RIBBON O
N
"); //使用碳带
//TSCLIB_DLL.sendcommand("SET RIBBON O
FF
"); //使用碳带
//TSCLIB_DLL.sendcommand("SET ENCODER OFF"); //碳带编码器检测
//TSCLIB_DLL.sendcommand("SET ENCODER OFF"); //碳带编码器检测
TSCLIB_DLL
.
sendcommand
(
$
"OFFSET {tscConfig.Offset} mm"
);
//出纸偏移
//
TSCLIB_DLL.sendcommand($"OFFSET {tscConfig.Offset} mm"); //出纸偏移
TSCLIB_DLL
.
sendcommand
(
$
"SPEED {tscConfig.Speed}"
);
//速度最大15
//
TSCLIB_DLL.sendcommand($"SPEED {tscConfig.Speed}"); //速度最大15
TSCLIB_DLL
.
sendcommand
(
$
"DENSITY {tscConfig.Density}"
);
//浓度最大15
//
TSCLIB_DLL.sendcommand($"DENSITY {tscConfig.Density}"); //浓度最大15
TSCLIB_DLL
.
sendcommand
(
$
"DIRECTION {tscConfig.Direction}"
);
//TSCLIB_DLL.sendcommand($"DIRECTION {tscConfig.Direction}");
TSCLIB_DLL
.
clearbuffer
();
TSCLIB_DLL
.
clearbuffer
();
TSCLIB_DLL
.
sendpicture
(
tscConfig
.
x
,
tscConfig
.
y
,
bmp
);
TSCLIB_DLL
.
sendpicture
(
tscConfig
.
x
,
tscConfig
.
y
,
bmp
);
...
@@ -486,7 +489,58 @@ namespace Asa
...
@@ -486,7 +489,58 @@ namespace Asa
return
true
;
return
true
;
//Console.WriteLine("usbportqueryprinter:" + TSCLIB_DLL.usbportqueryprinter());
//Console.WriteLine("usbportqueryprinter:" + TSCLIB_DLL.usbportqueryprinter());
}
}
TscStauts
CheckTscStatus
()
{
public
bool
PrintCommandToTsc
(
string
command
,
TscConfig
tscConfig
,
out
TscStauts
tscStauts
)
{
tscStauts
=
CheckTscStatus
();
if
(
tscStauts
!=
0
)
{
var
err
=
(
TscStauts
)
tscStauts
;
Console
.
WriteLine
(
$
"Error: {err}"
);
return
false
;
}
var
printt
=
Task
.
Run
(()
=>
{
try
{
TSCSDK
.
driver
TSCLIB_DLL
=
new
TSCSDK
.
driver
();
TSCLIB_DLL
.
openport
(
tscConfig
.
PrinterName
);
var
commands
=
command
.
Split
(
new
char
[]
{
'\r'
,
'\n'
},
StringSplitOptions
.
RemoveEmptyEntries
);
for
(
int
i
=
0
;
i
<
commands
.
Length
;
i
++)
{
if
(!
commands
[
i
].
StartsWith
(
"PRINT"
))
TSCLIB_DLL
.
sendcommand
(
commands
[
i
].
Trim
());
else
TSCLIB_DLL
.
printlabel
(
"1"
,
"1"
);
}
TSCLIB_DLL
.
closeport
();
}
catch
(
Exception
e
)
{
}
finally
{
//bmp?.Dispose();
}
});
tscStauts
=
CheckTscStatus
();
Console
.
WriteLine
(
"After print:"
+
tscStauts
);
Task
.
Delay
(
500
).
Wait
();
if
(
printt
.
IsCompleted
)
{
}
if
(
tscStauts
==
TscStauts
.
打印中
||
tscStauts
==
TscStauts
.
准备就绪
||
tscStauts
==
TscStauts
.
None
)
{
return
true
;
}
else
{
return
false
;
}
//Console.WriteLine("usbportqueryprinter:" + TSCLIB_DLL.usbportqueryprinter());
}
public
TscStauts
CheckTscStatus
()
{
//return TscStauts.准备就绪;
//return TscStauts.准备就绪;
TscStauts
s
=
TscStauts
.
None
;
TscStauts
s
=
TscStauts
.
None
;
var
t
=
Task
.
Run
(()
=>
{
var
t
=
Task
.
Run
(()
=>
{
...
@@ -504,7 +558,7 @@ namespace Asa
...
@@ -504,7 +558,7 @@ namespace Asa
}
}
}
}
});
});
if
(!
t
.
Wait
(
1
000
))
if
(!
t
.
Wait
(
3
000
))
Console
.
WriteLine
(
"usbportqueryprinter time out"
);
Console
.
WriteLine
(
"usbportqueryprinter time out"
);
return
s
;
return
s
;
}
}
...
...
PrintLabel_Test/Form1.Designer.cs
查看文件 @
463738c
...
@@ -41,15 +41,18 @@
...
@@ -41,15 +41,18 @@
this
.
advanceConfigEdit1
=
new
ConfigHelper
.
AdvanceConfigEdit
();
this
.
advanceConfigEdit1
=
new
ConfigHelper
.
AdvanceConfigEdit
();
this
.
button7
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button7
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button10
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button10
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
txt_command
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
groupBox1
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
button6
=
new
System
.
Windows
.
Forms
.
Button
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
BeginInit
();
this
.
groupBox1
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
// button1
// button1
//
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
13
);
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
9
);
this
.
button1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
74
);
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
49
);
this
.
button1
.
TabIndex
=
0
;
this
.
button1
.
TabIndex
=
0
;
this
.
button1
.
Text
=
"编辑"
;
this
.
button1
.
Text
=
"编辑"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
...
@@ -57,19 +60,17 @@
...
@@ -57,19 +60,17 @@
//
//
// textBox1
// textBox1
//
//
this
.
textBox1
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
14
);
this
.
textBox1
.
Location
=
new
System
.
Drawing
.
Point
(
137
,
9
);
this
.
textBox1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
textBox1
.
Name
=
"textBox1"
;
this
.
textBox1
.
Name
=
"textBox1"
;
this
.
textBox1
.
Size
=
new
System
.
Drawing
.
Size
(
241
,
28
);
this
.
textBox1
.
Size
=
new
System
.
Drawing
.
Size
(
162
,
21
);
this
.
textBox1
.
TabIndex
=
1
;
this
.
textBox1
.
TabIndex
=
1
;
this
.
textBox1
.
Text
=
"test2"
;
this
.
textBox1
.
Text
=
"test2"
;
//
//
// button2
// button2
//
//
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
102
);
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
137
,
68
);
this
.
button2
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
1
50
,
34
);
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
1
00
,
23
);
this
.
button2
.
TabIndex
=
2
;
this
.
button2
.
TabIndex
=
2
;
this
.
button2
.
Text
=
"加载"
;
this
.
button2
.
Text
=
"加载"
;
this
.
button2
.
UseVisualStyleBackColor
=
true
;
this
.
button2
.
UseVisualStyleBackColor
=
true
;
...
@@ -77,10 +78,9 @@
...
@@ -77,10 +78,9 @@
//
//
// button3
// button3
//
//
this
.
button3
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
102
);
this
.
button3
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
68
);
this
.
button3
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button3
.
Name
=
"button3"
;
this
.
button3
.
Name
=
"button3"
;
this
.
button3
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
74
);
this
.
button3
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
49
);
this
.
button3
.
TabIndex
=
3
;
this
.
button3
.
TabIndex
=
3
;
this
.
button3
.
Text
=
"打印"
;
this
.
button3
.
Text
=
"打印"
;
this
.
button3
.
UseVisualStyleBackColor
=
true
;
this
.
button3
.
UseVisualStyleBackColor
=
true
;
...
@@ -88,19 +88,17 @@
...
@@ -88,19 +88,17 @@
//
//
// textBox2
// textBox2
//
//
this
.
textBox2
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
59
);
this
.
textBox2
.
Location
=
new
System
.
Drawing
.
Point
(
137
,
39
);
this
.
textBox2
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
textBox2
.
Name
=
"textBox2"
;
this
.
textBox2
.
Name
=
"textBox2"
;
this
.
textBox2
.
Size
=
new
System
.
Drawing
.
Size
(
241
,
28
);
this
.
textBox2
.
Size
=
new
System
.
Drawing
.
Size
(
162
,
21
);
this
.
textBox2
.
TabIndex
=
4
;
this
.
textBox2
.
TabIndex
=
4
;
this
.
textBox2
.
Text
=
"ZDesigner GT800 (EPL)"
;
this
.
textBox2
.
Text
=
"ZDesigner GT800 (EPL)"
;
//
//
// button4
// button4
//
//
this
.
button4
.
Location
=
new
System
.
Drawing
.
Point
(
205
,
144
);
this
.
button4
.
Location
=
new
System
.
Drawing
.
Point
(
137
,
96
);
this
.
button4
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button4
.
Name
=
"button4"
;
this
.
button4
.
Name
=
"button4"
;
this
.
button4
.
Size
=
new
System
.
Drawing
.
Size
(
1
50
,
34
);
this
.
button4
.
Size
=
new
System
.
Drawing
.
Size
(
1
00
,
23
);
this
.
button4
.
TabIndex
=
5
;
this
.
button4
.
TabIndex
=
5
;
this
.
button4
.
Text
=
"获取状态"
;
this
.
button4
.
Text
=
"获取状态"
;
this
.
button4
.
UseVisualStyleBackColor
=
true
;
this
.
button4
.
UseVisualStyleBackColor
=
true
;
...
@@ -108,19 +106,17 @@
...
@@ -108,19 +106,17 @@
//
//
// pictureBox1
// pictureBox1
//
//
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
456
,
426
);
this
.
pictureBox1
.
Location
=
new
System
.
Drawing
.
Point
(
216
,
252
);
this
.
pictureBox1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
pictureBox1
.
Name
=
"pictureBox1"
;
this
.
pictureBox1
.
Name
=
"pictureBox1"
;
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
376
,
244
);
this
.
pictureBox1
.
Size
=
new
System
.
Drawing
.
Size
(
251
,
163
);
this
.
pictureBox1
.
TabIndex
=
6
;
this
.
pictureBox1
.
TabIndex
=
6
;
this
.
pictureBox1
.
TabStop
=
false
;
this
.
pictureBox1
.
TabStop
=
false
;
//
//
// button5
// button5
//
//
this
.
button5
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
188
);
this
.
button5
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
125
);
this
.
button5
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button5
.
Name
=
"button5"
;
this
.
button5
.
Name
=
"button5"
;
this
.
button5
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
70
);
this
.
button5
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
47
);
this
.
button5
.
TabIndex
=
7
;
this
.
button5
.
TabIndex
=
7
;
this
.
button5
.
Text
=
"button5"
;
this
.
button5
.
Text
=
"button5"
;
this
.
button5
.
UseVisualStyleBackColor
=
true
;
this
.
button5
.
UseVisualStyleBackColor
=
true
;
...
@@ -128,10 +124,9 @@
...
@@ -128,10 +124,9 @@
//
//
// btn_tsc
// btn_tsc
//
//
this
.
btn_tsc
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
437
);
this
.
btn_tsc
.
Location
=
new
System
.
Drawing
.
Point
(
16
,
291
);
this
.
btn_tsc
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
btn_tsc
.
Name
=
"btn_tsc"
;
this
.
btn_tsc
.
Name
=
"btn_tsc"
;
this
.
btn_tsc
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
63
);
this
.
btn_tsc
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
42
);
this
.
btn_tsc
.
TabIndex
=
8
;
this
.
btn_tsc
.
TabIndex
=
8
;
this
.
btn_tsc
.
Text
=
"TSC Print"
;
this
.
btn_tsc
.
Text
=
"TSC Print"
;
this
.
btn_tsc
.
UseVisualStyleBackColor
=
true
;
this
.
btn_tsc
.
UseVisualStyleBackColor
=
true
;
...
@@ -140,26 +135,24 @@
...
@@ -140,26 +135,24 @@
// cb_labelname
// cb_labelname
//
//
this
.
cb_labelname
.
FormattingEnabled
=
true
;
this
.
cb_labelname
.
FormattingEnabled
=
true
;
this
.
cb_labelname
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
378
);
this
.
cb_labelname
.
Location
=
new
System
.
Drawing
.
Point
(
16
,
252
);
this
.
cb_labelname
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
cb_labelname
.
Name
=
"cb_labelname"
;
this
.
cb_labelname
.
Name
=
"cb_labelname"
;
this
.
cb_labelname
.
Size
=
new
System
.
Drawing
.
Size
(
238
,
26
);
this
.
cb_labelname
.
Size
=
new
System
.
Drawing
.
Size
(
160
,
20
);
this
.
cb_labelname
.
TabIndex
=
9
;
this
.
cb_labelname
.
TabIndex
=
9
;
//
//
// advanceConfigEdit1
// advanceConfigEdit1
//
//
this
.
advanceConfigEdit1
.
Location
=
new
System
.
Drawing
.
Point
(
456
,
13
);
this
.
advanceConfigEdit1
.
Location
=
new
System
.
Drawing
.
Point
(
304
,
9
);
this
.
advanceConfigEdit1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
);
this
.
advanceConfigEdit1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
4
,
4
,
4
);
this
.
advanceConfigEdit1
.
Name
=
"advanceConfigEdit1"
;
this
.
advanceConfigEdit1
.
Name
=
"advanceConfigEdit1"
;
this
.
advanceConfigEdit1
.
Size
=
new
System
.
Drawing
.
Size
(
655
,
391
);
this
.
advanceConfigEdit1
.
Size
=
new
System
.
Drawing
.
Size
(
437
,
209
);
this
.
advanceConfigEdit1
.
TabIndex
=
10
;
this
.
advanceConfigEdit1
.
TabIndex
=
10
;
//
//
// button7
// button7
//
//
this
.
button7
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
508
);
this
.
button7
.
Location
=
new
System
.
Drawing
.
Point
(
16
,
339
);
this
.
button7
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button7
.
Name
=
"button7"
;
this
.
button7
.
Name
=
"button7"
;
this
.
button7
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
63
);
this
.
button7
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
42
);
this
.
button7
.
TabIndex
=
12
;
this
.
button7
.
TabIndex
=
12
;
this
.
button7
.
Text
=
"X400"
;
this
.
button7
.
Text
=
"X400"
;
this
.
button7
.
UseVisualStyleBackColor
=
true
;
this
.
button7
.
UseVisualStyleBackColor
=
true
;
...
@@ -167,20 +160,52 @@
...
@@ -167,20 +160,52 @@
//
//
// button10
// button10
//
//
this
.
button10
.
Location
=
new
System
.
Drawing
.
Point
(
24
,
588
);
this
.
button10
.
Location
=
new
System
.
Drawing
.
Point
(
16
,
392
);
this
.
button10
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
button10
.
Name
=
"button10"
;
this
.
button10
.
Name
=
"button10"
;
this
.
button10
.
Size
=
new
System
.
Drawing
.
Size
(
1
84
,
63
);
this
.
button10
.
Size
=
new
System
.
Drawing
.
Size
(
1
23
,
42
);
this
.
button10
.
TabIndex
=
15
;
this
.
button10
.
TabIndex
=
15
;
this
.
button10
.
Text
=
"X6"
;
this
.
button10
.
Text
=
"X6"
;
this
.
button10
.
UseVisualStyleBackColor
=
true
;
this
.
button10
.
UseVisualStyleBackColor
=
true
;
this
.
button10
.
Click
+=
new
System
.
EventHandler
(
this
.
button10_Click
);
this
.
button10
.
Click
+=
new
System
.
EventHandler
(
this
.
button10_Click
);
//
//
// txt_command
//
this
.
txt_command
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
txt_command
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
17
);
this
.
txt_command
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
txt_command
.
Multiline
=
true
;
this
.
txt_command
.
Name
=
"txt_command"
;
this
.
txt_command
.
ScrollBars
=
System
.
Windows
.
Forms
.
ScrollBars
.
Vertical
;
this
.
txt_command
.
Size
=
new
System
.
Drawing
.
Size
(
355
,
292
);
this
.
txt_command
.
TabIndex
=
16
;
//
// groupBox1
//
this
.
groupBox1
.
Controls
.
Add
(
this
.
txt_command
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
497
,
238
);
this
.
groupBox1
.
Name
=
"groupBox1"
;
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
361
,
312
);
this
.
groupBox1
.
TabIndex
=
17
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"RAW Command"
;
//
// button6
//
this
.
button6
.
Location
=
new
System
.
Drawing
.
Point
(
681
,
556
);
this
.
button6
.
Name
=
"button6"
;
this
.
button6
.
Size
=
new
System
.
Drawing
.
Size
(
177
,
23
);
this
.
button6
.
TabIndex
=
18
;
this
.
button6
.
Text
=
"Send"
;
this
.
button6
.
UseVisualStyleBackColor
=
true
;
this
.
button6
.
Click
+=
new
System
.
EventHandler
(
this
.
button6_Click
);
//
// Form1
// Form1
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
9F
,
18
F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12
F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1366
,
911
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
911
,
607
);
this
.
Controls
.
Add
(
this
.
button6
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
Controls
.
Add
(
this
.
button10
);
this
.
Controls
.
Add
(
this
.
button10
);
this
.
Controls
.
Add
(
this
.
button7
);
this
.
Controls
.
Add
(
this
.
button7
);
this
.
Controls
.
Add
(
this
.
advanceConfigEdit1
);
this
.
Controls
.
Add
(
this
.
advanceConfigEdit1
);
...
@@ -194,12 +219,13 @@
...
@@ -194,12 +219,13 @@
this
.
Controls
.
Add
(
this
.
button2
);
this
.
Controls
.
Add
(
this
.
button2
);
this
.
Controls
.
Add
(
this
.
textBox1
);
this
.
Controls
.
Add
(
this
.
textBox1
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
Name
=
"Form1"
;
this
.
Name
=
"Form1"
;
this
.
StartPosition
=
System
.
Windows
.
Forms
.
FormStartPosition
.
CenterScreen
;
this
.
StartPosition
=
System
.
Windows
.
Forms
.
FormStartPosition
.
CenterScreen
;
this
.
Text
=
"Form1"
;
this
.
Text
=
"Form1"
;
this
.
Load
+=
new
System
.
EventHandler
(
this
.
Form1_Load
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
Form1_Load
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pictureBox1
)).
EndInit
();
this
.
groupBox1
.
ResumeLayout
(
false
);
this
.
groupBox1
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
this
.
PerformLayout
();
...
@@ -220,6 +246,9 @@
...
@@ -220,6 +246,9 @@
private
ConfigHelper
.
AdvanceConfigEdit
advanceConfigEdit1
;
private
ConfigHelper
.
AdvanceConfigEdit
advanceConfigEdit1
;
private
System
.
Windows
.
Forms
.
Button
button7
;
private
System
.
Windows
.
Forms
.
Button
button7
;
private
System
.
Windows
.
Forms
.
Button
button10
;
private
System
.
Windows
.
Forms
.
Button
button10
;
private
System
.
Windows
.
Forms
.
TextBox
txt_command
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox1
;
private
System
.
Windows
.
Forms
.
Button
button6
;
}
}
}
}
PrintLabel_Test/Form1.cs
查看文件 @
463738c
...
@@ -23,10 +23,12 @@ namespace PrintLabel_Test
...
@@ -23,10 +23,12 @@ namespace PrintLabel_Test
private
void
Form1_Load
(
object
sender
,
EventArgs
e
)
private
void
Form1_Load
(
object
sender
,
EventArgs
e
)
{
{
print
=
new
Asa
.
PrintLabel
(
Application
.
StartupPath
+
"\\Label"
,
3
00
);
print
=
new
Asa
.
PrintLabel
(
Application
.
StartupPath
+
"\\Label"
,
1
00
);
print
.
PrintStatusChanged
+=
Print_PrintStatusChanged
;
print
.
PrintStatusChanged
+=
Print_PrintStatusChanged
;
loadlabelname
();
loadlabelname
();
ConfigHelper
.
Config
.
PropertyBind
(
"txt_command"
,
txt_command
,
"Text"
,
"TextChanged"
,
""
);
}
}
private
void
Print_PrintStatusChanged
(
Asa
.
PrintLabel
.
PrinterStatus
sta
,
string
msg
)
private
void
Print_PrintStatusChanged
(
Asa
.
PrintLabel
.
PrinterStatus
sta
,
string
msg
)
...
@@ -132,5 +134,11 @@ namespace PrintLabel_Test
...
@@ -132,5 +134,11 @@ namespace PrintLabel_Test
tscConfig
.
Directions
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Directions"
,
1
);
tscConfig
.
Directions
=
ConfigHelper
.
Config
.
Get
(
"Tsc_Directions"
,
1
);
print
.
PrintToTsc_X6
(
keys
,
tscConfig
,
out
TscStauts
tscStauts
);
print
.
PrintToTsc_X6
(
keys
,
tscConfig
,
out
TscStauts
tscStauts
);
}
}
private
void
button6_Click
(
object
sender
,
EventArgs
e
)
{
TscConfig
tscConfig
=
new
TscConfig
();
print
.
PrintCommandToTsc
(
txt_command
.
Text
.
Trim
(),
tscConfig
,
out
TscStauts
tscStauts
);
}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论