📄 frmprint.frm
字号:
VERSION 5.00
Object = "{98958EE2-9C75-11D1-9CFE-0060083A7314}#1.0#0"; "PRNTPRO1.OCX"
Begin VB.Form frmPrint
BorderStyle = 3 'Fixed Dialog
Caption = "打印通知单"
ClientHeight = 2052
ClientLeft = 48
ClientTop = 336
ClientWidth = 2808
Icon = "frmPrint.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2052
ScaleWidth = 2808
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Visible = 0 'False
Begin PRNTPRO1LibCtl.PrintPRO PrintPRO1
Left = 228
Top = 144
ErrStr = "INAIDJGEPDBNOLGMDKAIMGGLFOOCENINFAAONDHKDCJNDC"
ErrCode = 1717179196
ErrInfo = 666381833
AddCR = -1 'True
Alignment = 0
BackColor = 16777215
BackStyle = 0
BMargin = 331.2
CurrentX = 379.2
CurrentY = 331.2
DocName = "PrintPRO Document"
DrawMode = 13
DrawStyle = 1
DrawWidth = 1
FillColor = 0
FillStyle = 1
ForeColor = 0
LMargin = 379.2
ScaleMode = 1
TMargin = 331.2
WordWrap = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 7.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Picture = "frmPrint.frx":0442
AutoMargin = -1 'True
OutputFileName = ""
End
End
Attribute VB_Name = "frmPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Function PrintNotes(ByVal sNo As String, _
ByVal sCarMan As String, ByVal sMotorMan As String, _
ByVal sCarNumber As String, ByVal sPostName As String, _
ByVal sCaptureDateTime As String, _
ByVal sReson As String, _
ByVal sPrintDate As String, _
ByVal sPicFile As String, _
ByVal sCarStyle As String _
) As Boolean
Dim prWidth As Single, i As Integer, lError
Const CM = 566
PrintPRO1.PrintDialog
lError = PrintPRO1.PrintError
If lError = 0 Then
Screen.MousePointer = 11
PrintPRO1.DocName = "打印违章通知单"
PrintPRO1.SelectDefaultPrinter
For i = 1 To PrintPRO1.Copies
PrintPRO1.StartPrintDoc
PrintPRO1.BackStyle = 0 'Transparent background
PrintPRO1.ForeColor = RGB(0, 0, 0) 'Black background
PrintPRO1.BackColor = RGB(255, 255, 255) 'White text
'违章通知书
PrintPRO1.Font.Name = "黑体"
PrintPRO1.Font.Bold = False
PrintPRO1.Font.Size = 24
PrintPRO1.Alignment = ALIGN_CenterJustifyMiddle ' Center justify the text
prWidth = PrintPRO1.PWidth
PrintPRO1.PrintTextAligned "违 章 通 知 书", 0, 2 * CM, prWidth, 3 * CM
'打印编号
PrintPRO1.Font.Name = "宋体"
PrintPRO1.Font.Bold = False
PrintPRO1.Font.Size = 18
PrintPRO1.Alignment = ALIGN_RightJustifyMiddle ' Center justify the text
prWidth = PrintPRO1.PWidth
PrintPRO1.PrintTextAligned sNo, 0, 3 * CM, prWidth - 3 * CM, 4 * CM
'上端信息
Dim starLine As Single
Dim startCharLeft As Single, startCharTop As Single
PrintPRO1.Font.Name = "宋体"
PrintPRO1.Font.Bold = False
PrintPRO1.Font.Size = 12
PrintPRO1.Alignment = ALIGN_LeftJustifyMiddle ' Center justify the text
starLine = 4.5 * CM
startCharLeft = 2.5 * CM
startCharTop = 4.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop
PrintPRO1.PrintText "车 主:" & sCarMan
PrintPRO1.DrawLine starLine, startCharTop + 0.5 * CM, starLine + 5.7 * CM, startCharTop + 0.5 * CM
PrintPRO1.CurrentX = startCharLeft + 8 * CM
PrintPRO1.CurrentY = startCharTop
PrintPRO1.PrintText "姓 名:" & sMotorMan
PrintPRO1.DrawLine starLine + 8 * CM, startCharTop + 0.5 * CM, starLine + 14 * CM, startCharTop + 0.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + CM
PrintPRO1.PrintText "车牌号码:" & sCarNumber
PrintPRO1.DrawLine starLine, startCharTop + 1.5 * CM, starLine + 5.7 * CM, startCharTop + 1.5 * CM
PrintPRO1.CurrentX = startCharLeft + 8 * CM
PrintPRO1.CurrentY = startCharTop + CM
PrintPRO1.PrintText "违章地点:" & sPostName
PrintPRO1.DrawLine starLine + 8 * CM, startCharTop + 1.5 * CM, starLine + 14 * CM, startCharTop + 1.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + 2 * CM
PrintPRO1.PrintText "违章时间:" & sCaptureDateTime
PrintPRO1.DrawLine starLine, startCharTop + 2.5 * CM, starLine + 14 * CM, startCharTop + 2.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + 3 * CM
PrintPRO1.PrintText "违章原因:" & sReson
PrintPRO1.DrawLine starLine, startCharTop + 3.5 * CM, starLine + 14 * CM, startCharTop + 3.5 * CM
PrintPRO1.CurrentX = startCharLeft + 0.75 * CM
PrintPRO1.CurrentY = startCharTop + 4 * CM
PrintPRO1.PrintText "请在收到此通知5日内到交通秩序大队接受处罚。"
PrintPRO1.CurrentX = startCharLeft + 0.75 * CM
PrintPRO1.CurrentY = startCharTop + 4.8 * CM
PrintPRO1.PrintText "附违章现场照片:"
'图片
PrintPRO1.Picture = LoadPicture(sPicFile)
PrintPRO1.PrintPicture startCharLeft + 1.5 * CM, 10.8 * CM
Dim Top2 As Single
Top2 = 11.2 * CM + 288 * Screen.TwipsPerPixelY
PrintPRO1.Font.Name = "宋体"
PrintPRO1.Font.Bold = False
PrintPRO1.Font.Size = 16
PrintPRO1.Alignment = ALIGN_RightJustifyMiddle ' Center justify the text
prWidth = PrintPRO1.PWidth
PrintPRO1.PrintTextAligned "秦皇岛市公安交警支队", 0, Top2, prWidth - 2 * CM, Top2 + CM
PrintPRO1.Font.Name = "宋体"
PrintPRO1.Font.Bold = False
PrintPRO1.Font.Size = 12
PrintPRO1.Alignment = ALIGN_RightJustifyTop ' Center justify the text
prWidth = PrintPRO1.PWidth
PrintPRO1.PrintTextAligned sPrintDate, 0, Top2 + CM, prWidth - 2 * CM, Top2 + CM + CM
PrintPRO1.DrawStyle = STYLE_Dot
PrintPRO1.DrawLine startCharLeft, Top2 + 2.2 * CM, prWidth - 2 * CM, Top2 + 2.2 * CM
' 存根
Dim Top3 As Single
Top3 = Top2 + 3.6 * CM
starLine = starLine + CM
startCharLeft = startCharLeft + CM
startCharTop = Top3
PrintPRO1.DrawStyle = STYLE_Solid
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop
PrintPRO1.PrintText "车 主:" & sCarMan
PrintPRO1.DrawLine starLine, startCharTop + 0.5 * CM, starLine + 5.7 * CM, startCharTop + 0.5 * CM
PrintPRO1.CurrentX = startCharLeft + 8 * CM
PrintPRO1.CurrentY = startCharTop
PrintPRO1.PrintText "姓名:" & sMotorMan
PrintPRO1.DrawLine starLine + 7 * CM, startCharTop + 0.5 * CM, starLine + 12 * CM, startCharTop + 0.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + CM
PrintPRO1.PrintText "车牌号码:" & sCarNumber
PrintPRO1.DrawLine starLine, startCharTop + 1.5 * CM, starLine + 5.7 * CM, startCharTop + 1.5 * CM
PrintPRO1.CurrentX = startCharLeft + 8 * CM
PrintPRO1.CurrentY = startCharTop + CM
PrintPRO1.PrintText "车型:" & sCarStyle
PrintPRO1.DrawLine starLine + 7 * CM, startCharTop + 1.5 * CM, starLine + 12 * CM, startCharTop + 1.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + 2 * CM
PrintPRO1.PrintText "违章地点:" & sPostName
PrintPRO1.DrawLine starLine, startCharTop + 2.5 * CM, starLine + 12 * CM, startCharTop + 2.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + 3 * CM
PrintPRO1.PrintText "违章时间:" & sCaptureDateTime
PrintPRO1.DrawLine starLine, startCharTop + 3.5 * CM, starLine + 12 * CM, startCharTop + 3.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + 4 * CM
PrintPRO1.PrintText "处理结果:"
PrintPRO1.DrawLine starLine, startCharTop + 4.5 * CM, starLine + 12 * CM, startCharTop + 4.5 * CM
PrintPRO1.CurrentX = startCharLeft
PrintPRO1.CurrentY = startCharTop + 5 * CM
PrintPRO1.PrintText "违章人签字:"
PrintPRO1.DrawLine starLine + 0.5 * CM, startCharTop + 5.5 * CM, starLine + 6 * CM, startCharTop + 5.5 * CM
PrintPRO1.CurrentX = startCharLeft + 8 * CM
PrintPRO1.CurrentY = startCharTop + 5 * CM
PrintPRO1.PrintText "日期:"
PrintPRO1.DrawLine starLine + 8 * CM, startCharTop + 5.5 * CM, starLine + 12 * CM, startCharTop + 5.5 * CM
'编号和存根
PrintPRO1.Font.Name = "宋体"
PrintPRO1.Font.Bold = False
PrintPRO1.Font.Size = 18
PrintPRO1.Alignment = ALIGN_RightJustifyMiddle ' Center justify the text
prWidth = PrintPRO1.PWidth
PrintPRO1.PrintTextAligned sNo, 0, startCharTop - 1 * CM, prWidth - 3 * CM, startCharTop
PrintPRO1.Alignment = ALIGN_LeftJustifyMiddle ' Center justify the text
PrintPRO1.CurrentX = startCharLeft - CM
PrintPRO1.CurrentY = startCharTop + 1.2 * CM
PrintPRO1.PrintText "存"
PrintPRO1.CurrentX = startCharLeft - CM
PrintPRO1.CurrentY = startCharTop + 3.2 * CM
PrintPRO1.PrintText "根"
PrintPRO1.EndPrintDoc
Next i
Screen.MousePointer = 0
PrintNotes = True
Else
PrintNotes = False
End If
End Function
'扩充字符串到指定长度
Private Sub AddSpace(s As String, ByVal nLeng As Integer)
Dim i As Integer
s = Trim(s)
i = nLeng - Len(s)
If i > 0 Then
s = s & Space(i)
End If
End Sub
Private Sub Command4_Click()
'Call PrintNotes("No 0032031", "港务局6段", "张宏林", "冀C78964", "文化路北口岗", "2000年12月30日20点45分10秒", "闯红灯", "2000年12月21日", "f:\t.bmp", "桑塔纳轿车")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -