printpages.frm
来自「这个是我以前做的一个客户管理系统.包内已经含有源码和所用到的控件.代码是用VB写」· FRM 代码 · 共 331 行
FRM
331 行
VERSION 5.00
Begin VB.Form frmPrintPage
BorderStyle = 3 'Fixed Dialog
Caption = "选择打印页"
ClientHeight = 2415
ClientLeft = 45
ClientTop = 330
ClientWidth = 6330
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2415
ScaleWidth = 6330
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 435
Left = 4920
TabIndex = 17
Top = 1890
Width = 1335
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 435
Left = 3420
TabIndex = 16
Top = 1890
Width = 1335
End
Begin VB.Frame Frame2
Caption = "打印范围"
Height = 1605
Left = 90
TabIndex = 6
Top = 120
Width = 3285
Begin VB.OptionButton optAllPages
Caption = "全部"
Height = 300
Left = 150
TabIndex = 11
Top = 240
Width = 735
End
Begin VB.OptionButton optSelect
Caption = "选择范围"
Height = 270
Left = 150
TabIndex = 10
Top = 720
Width = 1035
End
Begin VB.TextBox txtFrmPage
Height = 285
Left = 1560
TabIndex = 9
Top = 690
Width = 405
End
Begin VB.TextBox txtToPage
Height = 285
Left = 2520
TabIndex = 8
Top = 690
Width = 405
End
Begin VB.OptionButton optCurPage
Caption = "当前页"
Height = 270
Left = 150
TabIndex = 7
Top = 1200
Width = 1035
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "从"
Height = 180
Left = 1290
TabIndex = 15
Top = 750
Width = 180
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "页 到"
Height = 180
Left = 2010
TabIndex = 14
Top = 750
Width = 450
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "页"
Height = 180
Left = 3000
TabIndex = 13
Top = 750
Width = 180
End
Begin VB.Label lblPageCount
AutoSize = -1 'True
Height = 180
Left = 1080
TabIndex = 12
Top = 270
Width = 90
End
End
Begin VB.Frame Frame1
Caption = "份数"
Height = 1605
Left = 3540
TabIndex = 0
Top = 120
Width = 2715
Begin VB.PictureBox picFy1
BorderStyle = 0 'None
Height = 615
Left = 180
Picture = "PrintPages.frx":0000
ScaleHeight = 615
ScaleWidth = 1485
TabIndex = 18
Top = 870
Width = 1485
End
Begin VB.CheckBox chkFY
Caption = "分页"
Height = 315
Left = 1860
TabIndex = 2
Top = 960
Width = 675
End
Begin VB.PictureBox picfy2
BorderStyle = 0 'None
Height = 525
Left = 150
Picture = "PrintPages.frx":28BA
ScaleHeight = 525
ScaleWidth = 1575
TabIndex = 1
Top = 900
Width = 1575
End
Begin VB.PictureBox UpDown1
Height = 255
Left = 2190
ScaleHeight = 195
ScaleWidth = 180
TabIndex = 4
Top = 330
Width = 240
End
Begin VB.TextBox txtCopies
Height = 315
Left = 1860
TabIndex = 3
Top = 300
Width = 585
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "份数:"
Height = 180
Left = 180
TabIndex = 5
Top = 390
Width = 450
End
End
End
Attribute VB_Name = "frmPrintPage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public mPageCount As Integer
Public mPageStart As Integer
Public mPageEnd As Integer
Public mCopies As Integer
Private Function mbCountPrintPage() As Boolean
'**************************************
'
'计算要打印的页数
mCopies = Int(txtCopies.Text)
If optAllPages.Value Then
mPageCount = mPageCount
mPageStart = 1
mPageEnd = mPageCount
ElseIf optSelect.Value Then
mPageStart = Int(txtFrmPage)
mPageEnd = Int(txtToPage)
Else
mPageStart = -1
mPageEnd = -1
mPageCount = -1
End If
mbCountPrintPage = True
End Function
Private Sub mSetPrintPage()
lblPageCount.Caption = mPageCount & "页"
txtFrmPage = 1
txtToPage = mPageCount
optAllPages.Value = True
End Sub
Private Sub mSetPrintCopies()
txtCopies = 1
chkFY.Value = Unchecked
picfy2.Visible = False
End Sub
Private Sub chkFY_Click()
If chkFY.Value = Unchecked Then
picfy2.Visible = False
picFy1.Visible = True
Else
picfy2.Visible = True
picFy1.Visible = False
End If
End Sub
Private Sub cmdCancel_Click()
mPageCount = -2
Me.Hide
End Sub
Private Sub cmdOk_Click()
If mbCountPrintPage() Then Me.Hide
End Sub
Private Sub Form_Load()
Center Me
'设置打印范围
Call mSetPrintPage
'设置打印份数
Call mSetPrintCopies
End Sub
Private Sub txtCopies_GotFocus()
txtCopies.SelStart = 1
txtCopies.SelLength = Len(txtCopies.Text)
End Sub
Private Sub txtCopies_KeyPress(KeyAscii As Integer)
KeyAscii = gNumericKey(KeyAscii)
End Sub
Private Sub txtCopies_Validate(Cancel As Boolean)
If Trim(txtCopies.Text) = "" Then
txtCopies.Text = 1
ElseIf txtCopies.Text = 0 Then
txtCopies.Text = 1
End If
End Sub
Private Sub txtFrmPage_GotFocus()
txtFrmPage.SelStart = 1
txtFrmPage.SelLength = Len(txtFrmPage.Text)
End Sub
Private Sub txtFrmPage_KeyPress(KeyAscii As Integer)
KeyAscii = gNumericKey(KeyAscii)
End Sub
Private Sub txtToPage_GotFocus()
txtToPage.SelStart = 1
txtToPage.SelLength = Len(txtToPage)
End Sub
Private Sub txtToPage_KeyPress(KeyAscii As Integer)
KeyAscii = gNumericKey(KeyAscii)
End Sub
Private Sub UpDown1_DownClick()
If Trim(txtCopies.Text) = "" Then
txtCopies.Text = 1
ElseIf Int(txtCopies.Text) <= 1 Then
Else
txtCopies.Text = Int(txtCopies.Text) - 1
End If
End Sub
Private Sub UpDown1_UpClick()
If Trim(txtCopies.Text) = "" Then
txtCopies.Text = 1
ElseIf Int(txtCopies.Text) < 100 Then
txtCopies = Int(txtCopies.Text) + 1
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?