📄 frmprint.frm
字号:
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmPrint
Caption = "Form1"
ClientHeight = 6015
ClientLeft = 60
ClientTop = 465
ClientWidth = 7920
LinkTopic = "Form1"
ScaleHeight = 6015
ScaleWidth = 7920
StartUpPosition = 3 '窗口缺省
Begin TabDlg.SSTab sstPrint
Height = 3615
Left = 240
TabIndex = 2
Top = 1080
Width = 5175
_ExtentX = 9128
_ExtentY = 6376
_Version = 393216
Tabs = 2
Tab = 1
TabsPerRow = 2
TabHeight = 520
TabCaption(0) = "按页面大小打印"
TabPicture(0) = "frmPrint.frx":0000
Tab(0).ControlEnabled= 0 'False
Tab(0).Control(0)= "optPortrait"
Tab(0).Control(1)= "cmdPrintNow(0)"
Tab(0).Control(2)= "optLand"
Tab(0).ControlCount= 3
TabCaption(1) = "按比例打印"
TabPicture(1) = "frmPrint.frx":001C
Tab(1).ControlEnabled= -1 'True
Tab(1).Control(0)= "lblMapUnits"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).Control(1)= "lblIwant"
Tab(1).Control(1).Enabled= 0 'False
Tab(1).Control(2)= "Label1"
Tab(1).Control(2).Enabled= 0 'False
Tab(1).Control(3)= "txtRatioScale"
Tab(1).Control(3).Enabled= 0 'False
Tab(1).Control(4)= "cmdPrintNow(1)"
Tab(1).Control(4).Enabled= 0 'False
Tab(1).ControlCount= 5
Begin VB.CommandButton cmdPrintNow
Caption = "打印"
Height = 495
Index = 1
Left = 1560
TabIndex = 10
Top = 2640
Width = 2055
End
Begin VB.TextBox txtRatioScale
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 555
Left = 1440
TabIndex = 9
Text = "Text1"
Top = 1920
Width = 2895
End
Begin VB.OptionButton optPortrait
Caption = "纵向打印"
Height = 180
Left = -73080
TabIndex = 6
Top = 1560
Width = 1095
End
Begin VB.CommandButton cmdPrintNow
Caption = "打印"
Height = 375
Index = 0
Left = -73320
TabIndex = 4
Top = 2040
Width = 1815
End
Begin VB.OptionButton optLand
Caption = "横向打印"
Height = 375
Left = -73080
TabIndex = 3
Top = 1080
Width = 1935
End
Begin VB.Label Label1
Caption = "1 :"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 840
TabIndex = 8
Top = 1920
Width = 495
End
Begin VB.Label lblIwant
Caption = "以该比例尺打印地图"
Height = 375
Left = 480
TabIndex = 7
Top = 1200
Width = 2055
End
Begin VB.Label lblMapUnits
Caption = "当前的地图单位是 _____, 其对于按照指定比例尺正确打印地图很重要。"
Height = 735
Left = 120
TabIndex = 5
Top = 480
Width = 4815
End
End
Begin VB.Label lblDefaultPrinter
BackColor = &H00E0E0E0&
Height = 255
Left = 240
TabIndex = 1
Top = 600
Width = 5175
End
Begin VB.Label lblDefaultLabel
BackColor = &H00E0E0E0&
Caption = "当前打印机型号:"
Height = 375
Left = 240
TabIndex = 0
Top = 240
Width = 5175
End
End
Attribute VB_Name = "frmPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
On Error Resume Next
frmPrint.Icon = LoadPicture(App.path & "\Bitmaps\earth.ico")
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 = "当前的地图单位是" & _
UCase(frmmain.strMapUnits) & "。其对于" & _
"按照指定比例尺正确打印地图很重要。 "
Else
lblMapUnits.Caption = "当前的地图单位是" & _
UCase(frmmain.strMapUnits) & "。按照指定比例尺打印地图无法实现;" & _
"请在地图属性对话框中选择正确的地图单位。"
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
'If frmmain.map_index = 1 Then
frmmain.Map1.PrintMap "MyMap", "", optLand.Value
' Else
'frmmain.Map3.PrintMap "MyMap", "", optLand.Value
' End If
'Print map to scale. Send to Windows default printer.
Case 1
' Dim scalePrinter As New clsPTSobj 'Print-to-scale object
' If frmmain.map_index = 1 Then
' Set scalePrinter.MapControl = frmmain.Map1
' Else
' Set scalePrinter.MapControl = frmmain.Map3
' End If
' scalePrinter.MapUnits = frmmain.strMapUnits
' If IsNumeric(txtRatioScale) Then
' scalePrinter.RatioScale = txtRatioScale.Text
' Else
' MsgBox "无效数据", vbCritical, "停止"
' Exit Sub
' End If
' scalePrinter.PrintNow
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -