📄 preview.frm
字号:
VERSION 5.00
Begin VB.Form frmPreview
BorderStyle = 1 'Fixed Single
Caption = "美食向导----预览、打印"
ClientHeight = 6420
ClientLeft = 45
ClientTop = 330
ClientWidth = 11310
Icon = "Preview.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6420
ScaleWidth = 11310
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "关闭"
Height = 375
Left = 10080
TabIndex = 13
Top = 5760
Width = 975
End
Begin VB.CommandButton cmdPrint
Caption = "打印菜单"
Height = 375
Left = 7800
TabIndex = 12
Top = 5760
Width = 1335
End
Begin VB.ListBox lstCustomer
ForeColor = &H00FF0000&
Height = 2940
ItemData = "Preview.frx":030A
Left = 7560
List = "Preview.frx":030C
TabIndex = 4
Top = 1800
Width = 3615
End
Begin VB.VScrollBar scrMenu
Height = 5535
Left = 7080
TabIndex = 2
Top = 480
Width = 375
End
Begin VB.PictureBox picWindow
BackColor = &H80000009&
Height = 5535
Left = 120
ScaleHeight = 5475
ScaleWidth = 6915
TabIndex = 0
Top = 480
Width = 6975
Begin VB.PictureBox picMenu
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000009&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 2640
Left = 0
ScaleHeight = 2640
ScaleWidth = 6960
TabIndex = 1
Top = 0
Width = 6960
Begin VB.Label lblList
Alignment = 2 'Center
BackColor = &H00C0C0FF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Index = 0
Left = 0
TabIndex = 3
Top = 1920
Width = 2295
End
Begin VB.Image imgList
Height = 1815
Index = 0
Left = 0
MouseIcon = "Preview.frx":030E
MousePointer = 99 'Custom
Stretch = -1 'True
Top = 0
Width = 2295
End
End
End
Begin VB.Label lblWait
Caption = "正在为打印做准备,请稍候..."
Height = 255
Left = 7560
TabIndex = 18
Top = 5880
Visible = 0 'False
Width = 2535
End
Begin VB.Label lblPay
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 255
Left = 7680
TabIndex = 17
Top = 5400
Width = 3255
End
Begin VB.Label lblBig
Alignment = 2 'Center
BeginProperty Font
Name = "隶书"
Size = 18
Charset = 134
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 1320
TabIndex = 16
Top = 0
Width = 4935
End
Begin VB.Label lblDir
AutoSize = -1 'True
Height = 180
Left = 360
TabIndex = 15
Top = 6120
Width = 90
End
Begin VB.Label Label1
Caption = "菜单预览:"
Height = 255
Left = 120
TabIndex = 14
Top = 120
Width = 975
End
Begin VB.Label lblTitle
Caption = "<菜单清单>"
ForeColor = &H00FF0000&
Height = 255
Left = 8880
TabIndex = 11
Top = 1320
Width = 975
End
Begin VB.Label lblCustomerID
BackStyle = 0 'Transparent
Caption = "您的标识:"
ForeColor = &H00FF0000&
Height = 255
Left = 7560
TabIndex = 10
Top = 120
Width = 3615
End
Begin VB.Label lblOrderDate
BackStyle = 0 'Transparent
Caption = "订餐日期:"
ForeColor = &H00FF0000&
Height = 255
Left = 7560
TabIndex = 9
Top = 480
Width = 2055
End
Begin VB.Label lblDinnerDate
BackStyle = 0 'Transparent
Caption = "用餐日期:"
ForeColor = &H00FF0000&
Height = 255
Left = 7560
TabIndex = 8
Top = 840
Width = 2055
End
Begin VB.Label lblSetCount
BackStyle = 0 'Transparent
Caption = "订餐套数:"
ForeColor = &H00FF0000&
Height = 255
Left = 7560
TabIndex = 7
Top = 1200
Width = 1455
End
Begin VB.Label lblItem
BackStyle = 0 'Transparent
Caption = "份数: 种类: 单价(元):"
ForeColor = &H00FF0000&
Height = 255
Left = 7560
TabIndex = 6
Top = 1560
Width = 3695
End
Begin VB.Label lblTotal
Appearance = 0 'Flat
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 375
Left = 7680
TabIndex = 5
Top = 4920
Width = 3255
End
Begin VB.Image imgBig
BorderStyle = 1 'Fixed Single
Height = 5535
Left = 120
MouseIcon = "Preview.frx":0460
MousePointer = 99 'Custom
Stretch = -1 'True
Top = 500
Width = 6975
End
End
Attribute VB_Name = "frmPreview"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public blnScrVisible As Boolean
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdPrint_Click()
On Error GoTo Eh
Dim W As Single
Dim sngH As Single
Dim I As Integer
W = 12.5
cmdPrint.Visible = False
lblWait.Visible = True
DoEvents
With Printer
.ScaleMode = 7
.Font.Size = 12
sngH = .TextHeight(frmGuest.lblWelcome(0)) + 0.1
.Width = 576 * W
.Height = 576 * (10 + lstCustomer.ListCount * sngH)
.Font.Name = "隶书"
.Font.Size = 20
.CurrentX = (W - .TextWidth(frmGuest.lblWelcome(0))) / 2
.CurrentY = 1
Printer.Print frmGuest.lblWelcome(0)
.Font.Italic = True
.Font.Underline = True
.Font.Name = "楷体_GB2312"
.Font.Size = 14
.CurrentX = (W - .TextWidth(frmGuest.lblTele)) / 2
.CurrentY = 2
Printer.Print frmGuest.lblTele
.Font.Italic = False
.Font.Underline = False
.Font.Size = 12
.CurrentX = 2
.CurrentY = 3
Printer.Print lblCustomerID
sngH = .TextHeight(lblCustomerID)
.CurrentX = 2
.CurrentY = 3 + sngH
Printer.Print lblOrderDate
.CurrentX = 2
.CurrentY = 3 + sngH * 2
Printer.Print lblDinnerDate
.CurrentX = 2
.CurrentY = 3 + sngH * 3
Printer.Print lblSetCount
.CurrentX = 5
.CurrentY = 3 + sngH * 4
Printer.Print lblTitle
.CurrentX = 2
.CurrentY = 3 + sngH * 5
Printer.Print lblItem
For I = 0 To lstCustomer.ListCount - 1
.CurrentX = 2
.CurrentY = 3 + sngH * (I + 6)
Printer.Print lstCustomer.List(I)
Next I
.CurrentX = 2
.CurrentY = 3 + sngH * (I + 8)
Printer.Print lblTotal
.CurrentX = 2
.CurrentY = 3 + sngH * (I + 9)
Printer.Print lblPay
.CurrentX = 2
.CurrentY = 3 + sngH * (I + 12)
Printer.Print "------结束(打印日期:" & Format(Date, "YYYY-MM-DD") & ")------"
.CurrentX = 2
.CurrentY = 3 + sngH * (I + 16)
Printer.Print
lblWait.Visible = False
If MsgBox("现在开始打印。请加纸。", vbInformation + vbOKCancel, "打印菜单") = vbOK Then
.EndDoc
Else
.KillDoc
End If
End With
cmdPrint.Visible = True
Exit Sub
Eh:
MsgBox "打印时发生错误:" & vbCrLf & Err.Description, vbInformation, "打印出错"
End Sub
Private Sub imgBig_Click()
imgBig.Visible = False
lblBig.Visible = False
picWindow.Visible = True
scrMenu.Visible = blnScrVisible
End Sub
Private Sub imgList_Click(Index As Integer)
scrMenu.Visible = False
Dim I As Integer
For I = 0 To imgList.Count - 1
lblList(I).ForeColor = &H80000012
Next I
lblList(Index).ForeColor = vbBlue
imgBig.Picture = imgList(Index).Picture
lblBig = lblList(Index)
imgBig.Visible = True
lblBig.Visible = True
picWindow.Visible = False
lstCustomer.ListIndex = Index
End Sub
Private Sub lstCustomer_Click()
imgList_Click lstCustomer.ListIndex
End Sub
Private Sub scrMenu_Change()
picMenu.Top = -scrMenu.Value / 1000 * picMenu.Height
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -