📄 frmprint.frm
字号:
_cy = 9842
Appearance = 1
BorderStyle = 1
Enabled = -1 'True
MousePointer = 0
BackColor = -2147483634
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty HdrFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Courier New"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_ConvInfo = -1
AutoRTF = -1 'True
Preview = -1 'True
DefaultDevice = 0 'False
PhysicalPage = -1 'True
AbortWindow = -1 'True
AbortWindowPos = 0
AbortCaption = "Printing..."
AbortTextButton = "Cancel"
AbortTextDevice = "on the %s on %s"
AbortTextPage = "Now printing Page %d of"
FileName = ""
MarginLeft = 1440
MarginTop = 2880
MarginRight = 1440
MarginBottom = 2880
MarginHeader = 0
MarginFooter = 0
IndentLeft = 0
IndentRight = 0
IndentFirst = 0
IndentTab = 720
SpaceBefore = 0
SpaceAfter = 0
LineSpacing = 100
Columns = 1
ColumnSpacing = 180
ShowGuides = 2
LargeChangeHorz = 300
LargeChangeVert = 300
SmallChangeHorz = 30
SmallChangeVert = 30
Track = 0 'False
ProportionalBars= -1 'True
Zoom = 29.9465240641711
ZoomMode = 3
ZoomMax = 400
ZoomMin = 10
ZoomStep = 5
EmptyColor = -2147483633
TextColor = 0
HdrColor = 0
BrushColor = 0
BrushStyle = 0
PenColor = 0
PenStyle = 0
PenWidth = 0
PageBorder = 0
Header = ""
Footer = ""
TableSep = "|;"
TableBorder = 7
TablePen = 0
TablePenLR = 0
TablePenTB = 0
NavBar = 0
NavBarColor = -2147483633
ExportFormat = 0
URL = ""
Navigation = 3
NavBarMenuText = "Whole &Page|Page &Width|&Two Pages|Thumb&nail"
End
Begin VB.Label lblPage
Alignment = 2 'Center
AutoSize = -1 'True
BackColor = &H80000009&
Caption = "1 of 1"
Height = 330
Left = 315
TabIndex = 20
Top = 3540
Width = 2220
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000009&
Caption = "缩放"
Height = 270
Left = 315
TabIndex = 19
Top = 1290
Width = 1125
End
End
End
Attribute VB_Name = "frmPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private oRs4This As New ADODB.Recordset
Private oRs4That As New ADODB.Recordset
Private m_strSQL As String
Public g_str4MainPrint As String
Private Sub chkShowGuides_Click()
If chkShowGuides Then
VSPrinter.ShowGuides = gdShow
Else
VSPrinter.ShowGuides = gdHide
End If
End Sub
Private Sub cmbPercent_Click()
VSPrinter.Zoom = Val(cmbPercent.list(cmbPercent.ListIndex))
End Sub
Private Sub cmbZoomMode_Click()
If cmbZoomMode.ListIndex = 0 Then
cmbPercent_Click
cmbPercent.Enabled = True
Else
cmbPercent.Enabled = False
VSPrinter.ZoomMode = cmbZoomMode.ListIndex
End If
End Sub
Private Sub cmdFirst_Click()
VSPrinter.PreviewPage = 1
scrlPage.Value = 1
End Sub
Private Sub cmdGoto_Click()
Dim mGoto
With VSPrinter
mGoto = InputBox("Go to Page", "", .PreviewPage)
If Val(mGoto) > .PageCount Or Val(mGoto) < 0 Then Exit Sub
.PreviewPage = Val(mGoto)
scrlPage.Value = .PreviewPage
End With
End Sub
Private Sub cmdLast_Click()
With VSPrinter
.PreviewPage = .PageCount
scrlPage.Value = .PageCount
End With
End Sub
Private Sub cmdNext_Click()
With VSPrinter
If .PreviewPage = .PageCount Then
Exit Sub
End If
.PreviewPage = .PreviewPage + 1
scrlPage.Value = .PreviewPage
End With
End Sub
Private Sub cmdPrevious_Click()
With VSPrinter
If .PreviewPage = 1 Then
Exit Sub
End If
.PreviewPage = .PreviewPage - 1
scrlPage.Value = .PreviewPage
End With
End Sub
Private Sub cmdPrint_Click()
MousePointer = 11
If VSPrinter.PageCount > 0 Then VSPrinter.PrintDoc
MousePointer = 1
End Sub
Private Sub cmdPrinterSetup_Click()
' VSPrinter.PrintDialog pdPrinterSetup
' Call Form_Load
Unload Me
MDIfrmMain.CommonDialog4DBFile.ShowPrinter
Me.Show 1
End Sub
Private Sub Command4Close_Click()
Unload Me
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then SendKeys "{tab}"
End Sub
Private Sub Form_Resize()
On Error Resume Next
With VSPrinter
.Move .left, .top, ScaleWidth - .left - 200, ScaleHeight - .top - 200
End With
Me.Label4PrintHead.top = 90
Me.Label4PrintHead.left = Me.Width / 2
End Sub
Private Sub scrlPage_Change()
scrlPage.SmallChange = VSPrinter.PreviewPages
scrlPage.LargeChange = scrlPage.SmallChange
VSPrinter.PreviewPage = scrlPage.Value
Dim lbl4Text%
lbl4Text = VSPrinter.PreviewPage + VSPrinter.PreviewPages - 1
If lbl4Text > VSPrinter.PageCount Then lbl4Text = VSPrinter.PageCount
If lbl4Text < VSPrinter.PreviewPage Then lbl4Text = VSPrinter.PreviewPage
If lbl4Text > VSPrinter.PreviewPage Then
lblPage = VSPrinter.PreviewPage & " - " & lbl4Text & " of " & VSPrinter.PageCount
Else
lblPage = VSPrinter.PreviewPage & " of " & VSPrinter.PageCount
End If
End Sub
Private Sub VSPrinter_AfterUserPage()
'VSPrinter_MousePage 0
End Sub
Private Sub VSPrinter_EndDoc()
UpdateScroller
End Sub
Private Sub VSPrinter_EndPage()
scrlPage.Max = VSPrinter.PageCount
scrlPage.Value = VSPrinter.PreviewPage
scrlPage_Change
DoEvents
End Sub
Private Sub VSPrinter_Error()
MsgBox "The VSPrinter control raised the Error event with the " & VSPrinter.Error & " code."
End Sub
Sub UpdateScroller()
scrlPage.Max = VSPrinter.PageCount
scrlPage.Value = VSPrinter.PreviewPage
scrlPage_Change
End Sub
Private Sub Form_Load()
Dim oRs4Print As New ADODB.Recordset
Dim oRs4Report As New ADODB.Recordset
Dim m_command4oRs As New ADODB.Command
Dim m_params4oRs As ADODB.Parameters
Dim i, j As Integer
Me.top = (Screen.Height - Me.Height) / 2
Me.left = (Screen.Width - Me.Width) / 2
If oRs4Report.State = adStateOpen Then oRs4Report.Close
If oRs4Print.State = adStateOpen Then oRs4Print.Close
With VSPrinter
cmbPercent.ListIndex = 0
cmbZoomMode.ListIndex = 3
VSFlexGrid4This.LoadGrid App.Path & "\2000.txt", flexFileAll
VSFlexGrid4This.FixedCols = 0
VSFlexGrid4This.FixedRows = 0
VSFlexGrid4This.Visible = False
.StartDoc
.IndentLeft = 0
.IndentRight = 0
.IndentFirst = 0
.MarginLeft = 100
.MarginRight = 50
.Font.Name = "宋体"
.Font.Size = 22
.FontBold = True
.TextColor = RGB(0, 0, 0)
.IndentFirst = 40
' .CurrentX = .PaperWidth / 2 + 2000
' .CurrentY = 700
' .Text = "客户往来明细"
.Header = "|" & g_str4MainPrint
' .Font.Name = "宋体"
' .Font.Size = 9
' .Font.Bold = False
' .CurrentX = .PaperWidth / 2 - 1330
' .CurrentY = 1250
'.Text = Trim(Label_Area.Caption) & " " & Trim(Text_Area.Text) & Space(3) & Trim(Label_TotalDate.Caption) & Space(1) & Trim(Text_TotalDate.Text) & Space(40) & Trim(Label_Date.Caption) & Trim(Text_Date.Text)
'.Header = .Header & vbCrLf & m_strFirst & "||" & m_strSecond
' .Header = vbCrLf & "xxx" & "||yyy"
' .IndentLeft = .PaperWidth / 2 - 1500
' .CurrentY = 1500
.StartTable
.Font.Name = "宋体"
.Font.Size = 10
.Font.Bold = False
'.AddTable "|" & m_strFirst
.TableBorder = tbNone
.TableCell(tcRows) = 1
.EndTable
.RenderControl = Me.VSFlexGrid4This.hwnd
.EndDoc
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -