📄 prnprv.frm
字号:
End
Begin VB.CommandButton Cmd
Height = 280
Index = 7
Left = 2088
Picture = "PrnPRV.frx":070E
Style = 1 'Graphical
TabIndex = 6
ToolTipText = "next page (PgDn)"
Top = 0
UseMaskColor = -1 'True
Width = 290
End
Begin VB.CommandButton Cmd
Height = 280
Index = 8
Left = 2376
Picture = "PrnPRV.frx":0810
Style = 1 'Graphical
TabIndex = 5
ToolTipText = "last page"
Top = 0
UseMaskColor = -1 'True
Width = 290
End
Begin VB.CommandButton Cmd
Height = 280
Index = 9
Left = 2700
Picture = "PrnPRV.frx":0912
Style = 1 'Graphical
TabIndex = 4
ToolTipText = "about..."
Top = 0
UseMaskColor = -1 'True
Width = 290
End
Begin VB.CommandButton Cmd
Height = 280
Index = 10
Left = 3024
Picture = "PrnPRV.frx":0A14
Style = 1 'Graphical
TabIndex = 3
ToolTipText = "close"
Top = 0
UseMaskColor = -1 'True
Width = 290
End
Begin VB.ComboBox ePag
Height = 300
ItemData = "PrnPRV.frx":0B16
Left = 4212
List = "PrnPRV.frx":0B18
Style = 2 'Dropdown List
TabIndex = 2
ToolTipText = "select (selected) page"
Top = 0
Width = 768
End
Begin VB.ComboBox zVal
Height = 300
ItemData = "PrnPRV.frx":0B1A
Left = 3384
List = "PrnPRV.frx":0B36
Style = 2 'Dropdown List
TabIndex = 1
ToolTipText = "zoom factor"
Top = 0
Width = 768
End
End
Begin MSComDlg.CommonDialog Apre
Left = 5760
Top = 900
_ExtentX = 688
_ExtentY = 688
_Version = 393216
End
End
Attribute VB_Name = "PrnPRV"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Function DoTest() As Integer
Static Dove As Integer
Dove = ANTEPRIMA
Prv.Cls
PrintBox 1, 1, 20, 28.7, Dove
PrintInLef 5, 5, "carattere: Arial", "Arial", 20, False, Dove
PrintInLef 5, 10, "carattere: Britannic Bold", "Britannic Bold", 20, False, Dove
PrintInLef 5, 15, "carattere: Castanet", "Castanet", 20, False, Dove
PrintInLef 5, 20, "carattere: Ms Sans Serif", "Ms Sans Serif", 20, False, Dove
PrintInLef 5, 21, "Ecco una prova di anteprima di stampa 'VIRTUALE'", "Ms Sans Serif", 20, False, Dove
End Function
Sub SetA4()
Prv.Width = Prv.Height * (21 / 29.7)
Prv.ScaleWidth = mm * 21
Prv.ScaleHeight = mm * 29.7
Scala = Prv.Height / Prv.ScaleHeight
End Sub
Sub MostraPagina()
Prv.ScaleMode = SistemaCoordinate
Prv.Width = (mm * 21) * (Val(zVal.Text) / 100) 'PrnPrv.ScaleWidth
Prv.Height = (mm * 29.7) * (Val(zVal.Text) / 100) 'PrnPrv.ScaleHeight
Prv.ScaleWidth = (mm * 21) 'PrnPrv.ScaleWidth
Prv.ScaleHeight = (mm * 29.7) 'PrnPrv.ScaleHeight
Prv.Refresh
Scala = PrnPRV.Prv.Height / PrnPRV.Prv.ScaleHeight
TempShow 0, 0, Prv.Width, Prv.Height
End Sub
Sub SistemaHBAR()
Static X1 As Single, Y1 As Single
Static X2 As Single, Y2 As Single
TempShow hBar.Value, vBar.Value, hBar.Value + hBar.Width, vBar.Value + vBar.Height
End Sub
Sub SistemaVBAR()
Static X1 As Single, Y1 As Single
Static X2 As Single, Y2 As Single
TempShow hBar.Value, vBar.Value, hBar.Value + hBar.Width, vBar.Value + vBar.Height
End Sub
Private Sub Cmd_Click(Index As Integer)
Select Case Index
Case 0 'refresh
MostraPagina
Case 1 'zoom in
If zVal.ListIndex < zVal.ListCount - 1 Then
zVal.ListIndex = zVal.ListIndex + 1
MostraPagina
End If
Case 2 'zoom out
If zVal.ListIndex > 0 Then
zVal.ListIndex = zVal.ListIndex - 1
MostraPagina
End If
Case 3 'sep
'PrnPRN1.Show vbModal
Case 4 'setup prn
Apre.Flags = cdlPDPrintSetup
Apre.Action = &H5
Case 5 'fst pg
If ePag.ListIndex > 0 Then
ePag.ListIndex = 0
MostraPagina
End If
Case 6 'prv pg
If ePag.ListIndex > 0 Then
ePag.ListIndex = ePag.ListIndex - 1
MostraPagina
End If
Case 7 'nxt pg
If ePag.ListIndex < ePag.ListCount - 1 Then
ePag.ListIndex = ePag.ListIndex + 1
MostraPagina
End If
Case 8 'lst pg
If ePag.ListIndex < ePag.ListCount - 1 Then
ePag.ListIndex = ePag.ListCount - 1
MostraPagina
End If
Case 9 'about
'PrnINFO.Show vbModal
Case 10 'unload
Unload Me
End Select
End Sub
Private Sub Command1_Click()
Static A%
A% = DoTest()
End Sub
Private Sub Command2_Click()
Prv.Cls
Prv.Width = Prv.Height * (21 / 29.7)
Prv.ScaleWidth = mm * 21
Prv.ScaleHeight = mm * 29.7
Scala = Prv.Height / Prv.ScaleHeight
End Sub
Private Sub Command3_Click()
Prv.Cls
Prv.Width = Prv.Height * (15 / 21)
Prv.ScaleWidth = mm * 15
Prv.ScaleHeight = mm * 21
Scala = Prv.Height / Prv.ScaleHeight
End Sub
Private Sub Command4_Click()
Prv.Cls
Prv.Width = Prv.Height * (29.7 / 42)
Prv.ScaleWidth = mm * 29.7
Prv.ScaleHeight = mm * 42
Scala = Prv.Height / Prv.ScaleHeight
End Sub
Private Sub Command5_Click()
Apre.Flags = cdlPDPrintSetup
Apre.Action = &H5
End Sub
Private Sub Command6_Click()
PrintRefGrid ANTEPRIMA
End Sub
Private Sub Command7_Click()
TempStampa 1, 1
End Sub
Private Sub Command8_Click()
Unload PrnPRV
End Sub
Private Sub Form_Activate()
MostraPagina
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
Unload Me
ElseIf KeyCode = vbKeyReturn Then
MostraPagina
ElseIf KeyCode = vbKeyHome Then
vBar.Value = vBar.Min
ElseIf KeyCode = vbKeyEnd Then
vBar.Value = vBar.Max
ElseIf KeyCode = vbKeyUp Then
If vBar.Value - vBar.LargeChange < vBar.Min Then
vBar.Value = vBar.Min
Else
vBar.Value = vBar.Value - vBar.LargeChange
End If
ElseIf KeyCode = vbKeyDown Then
If vBar.Value + vBar.LargeChange > vBar.Max Then
vBar.Value = vBar.Max
Else
vBar.Value = vBar.Value + vBar.LargeChange
End If
ElseIf KeyCode = vbKeyPageUp Then
If ePag.ListIndex > 0 Then
ePag.ListIndex = ePag.ListIndex - 1
MostraPagina
End If
ElseIf KeyCode = vbKeyPageDown Then
If ePag.ListIndex < ePag.ListCount - 1 Then
ePag.ListIndex = ePag.ListIndex + 1
MostraPagina
End If
ElseIf KeyCode = vbKeyRight Then
If hBar.Value + hBar.LargeChange > hBar.Max Then
hBar.Value = hBar.Max
Else
hBar.Value = hBar.Value + hBar.LargeChange
End If
ElseIf KeyCode = vbKeyLeft Then
If hBar.Value - hBar.LargeChange < hBar.Min Then
hBar.Value = hBar.Min
Else
hBar.Value = hBar.Value - hBar.LargeChange
End If
ElseIf KeyCode = vbKeyAdd Then
If zVal.ListIndex < zVal.ListCount - 1 Then
zVal.ListIndex = zVal.ListIndex + 1
MostraPagina
End If
ElseIf KeyCode = vbKeySubtract Then
If zVal.ListIndex > 0 Then
zVal.ListIndex = zVal.ListIndex - 1
MostraPagina
End If
End If
End Sub
Private Sub Form_Load()
LocPerc = CurDir
If Right(LocPerc, 1) <> "\" Then LocPerc = LocPerc + "\"
PrnPRV.Height = Screen.Height * 0.9
PrnPRV.Width = Screen.Width * 0.9
Prv.Width = PrnPRV.ScaleWidth - (vBar.Width + (NM_PP_Ofs * 2))
Prv.Height = PrnPRV.ScaleHeight - (hBar.Height + Cmd(0).Height + sBar.Height)
Prv.ScaleMode = SistemaCoordinate
Prv.Top = Cmd(0).Height
Prv.Left = NM_PP_Ofs
Prv.Width = PrnPRV.ScaleWidth - (vBar.Width + (NM_PP_Ofs * 2))
Prv.Height = PrnPRV.ScaleHeight - (hBar.Height + Cmd(0).Height + sBar.Height)
vBar.Top = Prv.Top
vBar.Left = Prv.Left + Prv.Width
vBar.Height = Prv.Height
hBar.Left = Prv.Left
hBar.Top = Prv.Top + Prv.Height
hBar.Width = Prv.Width
PrnPRV.Refresh
PrnPRV.Left = (Screen.Width / 2) - (PrnPRV.Width / 2)
PrnPRV.Top = (Screen.Height / 2) - (PrnPRV.Height / 2)
zVal.ListIndex = 3
Prv.Cls
PrnPRV.Show vbModeless
End Sub
Private Sub Form_Resize()
If PrnPRV.ScaleWidth > 1000 And PrnPRV.ScaleHeight > 1000 Then
Prv.Top = Cmd(0).Height
Prv.Left = NM_PP_Ofs
'Prv.Width = PrnPrv.ScaleWidth - (vBar.Width + (NM_PP_Ofs * 2))
'Prv.Height = PrnPrv.ScaleHeight - (hBar.Height + bBar.Height + sBar.Height)
vBar.Top = Cmd(0).Height
vBar.Left = PrnPRV.ScaleWidth - (vBar.Width + NM_PP_Ofs)
vBar.Height = PrnPRV.ScaleHeight - (Cmd(0).Height + sBar.Height + hBar.Height)
hBar.Top = PrnPRV.ScaleHeight - (sBar.Height + hBar.Height)
hBar.Left = NM_PP_Ofs
hBar.Width = PrnPRV.ScaleWidth - (vBar.Width + (NM_PP_Ofs * 2))
End If
End Sub
Private Sub hBar_Change()
SistemaHBAR
End Sub
Private Sub vBar_Change()
SistemaVBAR
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -