[Visual Basic] 纯文本查看 复制代码
Dim X1#, Y1#
Dim ii As Long
If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Then
MsgBox "数据不能为空", , "提示"
Else
Picture2.Width = p22 + CLng(Text19.Text)
BarCodeCtrl1.Width = p22 + CLng(Text19.Text)
Picture1.Width = p11 + CLng(Text19.Text)
Image2.Width = i11 + CLng(Text19.Text)
Picture4.Visible = False
Picture5.Visible = False
Image3.Visible = False
Picture1.Visible = True
Picture2.Visible = True
Image2.Visible = True
If Check3.Value = 1 Then
Text4.Enabled = False: Text4.BackColor = &H8000000F
Else
Text4.Enabled = True: Text4.BackColor = &H80000005
End If
BarCodeCtrl1.LineWeight = Text11.Text
BarCodeCtrl2.LineWeight = Text11.Text
p1 = CLng(Text8.Text)
p2 = CLng(Text9.Text)
PicTemp.Cls
PicTemp.Font.Name = "微软雅黑"
'==============条形码1
' BarCodeCtrl1.Style = 7
BarCodeCtrl1.Direction = 0
SHIJIAN = CStr(Format(Now, "yyyy-mm-dd hh:mm:ss"))
Shijian2 = Replace(SHIJIAN, "-", "")
Shijian2 = Replace(Shijian2, ":", "")
Shijian2 = Replace(Shijian2, " ", "")
TIM1 = "HM" & Shijian2 & CStr(Format(Text4.Text, "000"))
BarCodeCtrl1.Value = TIM1
' BarCodeCtrl1.HDC
Call PrintWindow(Picture2.hwnd, Picture1.HDC, 0)
Picture1.Refresh
Image2.Picture = Picture1.Image
PicTemp.PaintPicture Image2.Picture, p1 + CLng(Text14.Text), p2 + CLng(Text15.Text), Image2.Width, Image2.Height
PicTemp.FontBold = False
PicTemp.FontSize = 9
' aa = Replace(TIM1, "", " ")
aa = ""
For I = 1 To Len(TIM1)
If aa = "" Then
aa = aa & Mid(TIM1, I, 1)
Else
aa = aa & Text17.Text & Mid(TIM1, I, 1)
End If
Next I
PicTemp.CurrentX = 685 + p1 + CLng(Text14.Text)
PicTemp.CurrentY = 1105 + p2 + CLng(Text15.Text)
PicTemp.Print aa
'===============条形码2
' Picture2.Width = p22
' BarCodeCtrl1.Width = p22
' Picture1.Width = p11
' Image2.Width = i11
Picture4.Visible = True
Picture5.Visible = True
Image3.Visible = True
Picture1.Visible = False
Picture2.Visible = False
Image2.Visible = False
BarCodeCtrl1.Direction = 0
Select Case Combo3.Text
Case "无味磨砂"
YB = "20"
Case "无味透明"
YB = "10"
End Select
S = Split(Trim(Text2.Text), "*")
If InStr(CStr(S(0)), ".") > 0 Then
' If Len(CStr(S(0))) = 3 Then CD = REPLCE(CStr(S(0)), ".")
' If Len(CStr(S(0))) = 4 Then
' If CLng(S(0)) > 1 Then
' End If
CD = Replace(CStr(S(0)), ".", ""): CD = Mid(CD, 1, 2)
Else
CD = S(0) & "0"
End If
If Len(Trim(S(1))) = 4 Then
KD = CStr(CLng(S(1)) \ 10)
Else
KD = "0" & CStr(CLng(S(1)) \ 10)
End If
TIM2 = "SPR" & YB & CD & KD & "TM"
BarCodeCtrl2.Value = TIM2
Call PrintWindow(Picture4.hwnd, Picture5.HDC, 0)
Picture5.Refresh
Image3.Picture = Picture5.Image
PicTemp.PaintPicture Image3.Picture, p1 + CLng(Text13.Text), 2640 + p2 + CLng(Text12.Text), Image3.Width, Image3.Height
PicTemp.FontBold = False
PicTemp.FontSize = 9
' aa = Replace(TIM1, "", " ")
aa = ""
For I = 1 To Len(TIM2)
If aa = "" Then
aa = aa & Mid(TIM2, I, 1)
Else
aa = aa & Text17.Text & Mid(TIM2, I, 1)
End If
Next I
PicTemp.CurrentX = 1865 + p1 + CLng(Text13.Text)
PicTemp.CurrentY = 3750 + p2 + CLng(Text12.Text)
PicTemp.Print aa
'================
' PicTemp.FontBold = True
' PicTemp.FontSize = 10
'
' PicTemp.CurrentX = 3200 + p1
' PicTemp.CurrentY = 500 + p2
' PicTemp.Print aa
' PicTemp.FontBold = False
' PicTemp.FontSize = 8
' aa = "生产日期:" & Date$
' PicTemp.CurrentX = p1
' PicTemp.CurrentY = 3285 + p2
' PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "卷号"
PicTemp.CurrentX = 105 + p1
PicTemp.CurrentY = 2335 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "生产日期"
PicTemp.CurrentX = 2515 + p1
PicTemp.CurrentY = 2335 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = CStr(Text4.Text)
PicTemp.CurrentX = 1035 + p1
PicTemp.CurrentY = 2335 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
Shijian3 = Date$
PicTemp.CurrentX = 3750 + p1
PicTemp.CurrentY = 2335 + p2
PicTemp.Print Shijian3
'=====
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "规格"
PicTemp.CurrentX = 105 + p1
PicTemp.CurrentY = 1345 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "颜色"
PicTemp.CurrentX = 2515 + p1
PicTemp.CurrentY = 1345 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = Text2.Text
PicTemp.CurrentX = 1035 + p1
PicTemp.CurrentY = 1345 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = Text3.Text
PicTemp.CurrentX = 3750 + p1
PicTemp.CurrentY = 1345 + p2
PicTemp.Print aa
'=
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "花纹"
PicTemp.CurrentX = 105 + p1
PicTemp.CurrentY = 1675 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "油分"
PicTemp.CurrentX = 2515 + p1
PicTemp.CurrentY = 1675 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = CStr(Combo3.Text)
PicTemp.CurrentX = 1035 + p1
PicTemp.CurrentY = 1675 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = Text5.Text
PicTemp.CurrentX = 3750 + p1
PicTemp.CurrentY = 1675 + p2
PicTemp.Print aa
'==
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "班组"
PicTemp.CurrentX = 105 + p1
PicTemp.CurrentY = 2005 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = "重量(kg)"
PicTemp.CurrentX = 2515 + p1
PicTemp.CurrentY = 2005 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = Text6.Text
PicTemp.CurrentX = 1035 + p1
PicTemp.CurrentY = 2005 + p2
PicTemp.Print aa
PicTemp.FontBold = False
PicTemp.FontSize = 11
aa = Text7.Text
PicTemp.CurrentX = 3750 + p1
PicTemp.CurrentY = 2005 + p2
PicTemp.Print aa
'==============
PicTemp.Line (45 + p1, 1305 + p2)-(5205 + p1, 2625 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(770 + p1, 1635 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(2455 + p1, 1635 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(3525 + p1, 1635 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(5205 + p1, 1635 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(770 + p1, 1965 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(2455 + p1, 1965 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(3525 + p1, 1965 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(5205 + p1, 1965 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(770 + p1, 2295 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(2455 + p1, 2295 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(3525 + p1, 2295 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(5205 + p1, 2295 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(770 + p1, 2625 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(2455 + p1, 2625 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(3525 + p1, 2625 + p2), QBColor(1), B
PicTemp.Line (45 + p1, 1305 + p2)-(5205 + p1, 2625 + p2), QBColor(1), B