📄 print.frm
字号:
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmPrint
BorderStyle = 3 'Fixed Dialog
Caption = "Print the Map"
ClientHeight = 3990
ClientLeft = 45
ClientTop = 330
ClientWidth = 4965
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3990
ScaleWidth = 4965
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin TabDlg.SSTab sstPrint
Height = 3015
Left = 120
TabIndex = 0
Top = 840
Width = 4725
_ExtentX = 8334
_ExtentY = 5318
_Version = 393216
Tabs = 2
TabsPerRow = 2
TabHeight = 520
TabCaption(0) = "Print to Fill the Page"
TabPicture(0) = "Print.frx":0000
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "cmdPrintNow(0)"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "optLand"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "optPortrait"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).ControlCount= 3
TabCaption(1) = "Print to Scale"
TabPicture(1) = "Print.frx":001C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "lblMapUnits"
Tab(1).Control(1)= "lblIwant"
Tab(1).Control(2)= "lblOneTo"
Tab(1).Control(3)= "txtRatioScale"
Tab(1).Control(4)= "cmdPrintNow(1)"
Tab(1).ControlCount= 5
Begin VB.OptionButton optPortrait
Caption = "Portrait"
Height = 255
Left = 1680
TabIndex = 10
Top = 1200
Width = 1815
End
Begin VB.OptionButton optLand
Caption = "Landscape"
Height = 255
Left = 1680
TabIndex = 9
Top = 960
Value = -1 'True
Width = 1455
End
Begin VB.CommandButton cmdPrintNow
Caption = "Print Now"
Height = 495
Index = 1
Left = -73320
TabIndex = 8
Top = 2280
Width = 1335
End
Begin VB.TextBox txtRatioScale
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = -73680
TabIndex = 7
Top = 1680
Width = 2655
End
Begin VB.CommandButton cmdPrintNow
Caption = "Print Now"
Height = 495
Index = 0
Left = 1680
TabIndex = 3
Top = 1680
Width = 1335
End
Begin VB.Label lblOneTo
Alignment = 1 'Right Justify
Caption = "1 :"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = -74280
TabIndex = 6
Top = 1725
Width = 495
End
Begin VB.Label lblIwant
Caption = "I want my map printed to this ratio scale:"
Height = 255
Left = -74400
TabIndex = 5
Top = 1320
Width = 3255
End
Begin VB.Label lblMapUnits
Caption = $"Print.frx":0038
Height = 615
Left = -74760
TabIndex = 4
Top = 480
Width = 4095
End
End
Begin VB.Label lblDefaultPrinter
Alignment = 2 'Center
BackColor = &H00E0E0E0&
Height = 255
Left = 120
TabIndex = 2
Top = 360
Width = 4695
End
Begin VB.Label lblDefaultLabel
BackColor = &H00E0E0E0&
Caption = "Current Windows default printer:"
Height = 255
Left = 120
TabIndex = 1
Top = 120
Width = 4695
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 Sub Form_Load()
lblDefaultPrinter.Caption = Printer.DeviceName
sstPrint.Tab = 0
'Printing to fit the page will work whether or not
'the map units are defined on the MapProperties form.
'
'However, printing to scale will only work if the
'map units are known. Instruct the user if this is
'the case.
If frmMain.strMapUnits <> "Unknown" Then
lblMapUnits.Caption = "Your map units are currently set as " & _
UCase(frmMain.strMapUnits) & ". It is very important " & _
"that this be correct for the map to print to the " & _
"scale you expect."
Else
lblMapUnits.Caption = "Your map units are currently set as " & _
UCase(frmMain.strMapUnits) & ". Printing to scale " & _
"cannot continue. Please set the correct map units " & _
"in the Map Properties dialog."
lblOneTo.Enabled = False
lblIwant.Enabled = False
txtRatioScale.Enabled = False
cmdPrintNow(1).Enabled = False
End If
End Sub
Private Sub cmdPrintNow_Click(Index As Integer)
Select Case Index
'Fit map to page of the Windows default printer.
Case 0
frmMain.mapDisp.PrintMap "MyMap", "", optLand.Value
'Print map to scale. Send to Windows default printer.
Case 1
Dim scalePrinter As New clsPTSobj 'Print-to-scale object
Set scalePrinter.MapControl = frmMain.mapDisp
scalePrinter.MapUnits = frmMain.strMapUnits
If IsNumeric(txtRatioScale) Then
scalePrinter.RatioScale = txtRatioScale.text
Else
MsgBox "Invalid ratio scale entered.", vbCritical, "Stop"
Exit Sub
End If
scalePrinter.PrintNow
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -