📄 frmprintexport.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmPrintExport
Caption = "Print Setup"
ClientHeight = 2505
ClientLeft = 60
ClientTop = 345
ClientWidth = 5040
LinkTopic = "Form1"
ScaleHeight = 2505
ScaleWidth = 5040
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton CmdPrint
Caption = "&Print"
Height = 375
Left = 2640
TabIndex = 9
Top = 2040
Width = 1095
End
Begin VB.Frame fraPrinter
Caption = "Printer Setup"
Height = 1935
Left = 0
TabIndex = 1
Top = 0
Width = 4935
Begin VB.CommandButton cmdPrinter
Caption = "&Setup Printer..."
Height = 375
Left = 120
TabIndex = 2
Top = 1440
Width = 1935
End
Begin VB.Label lblPrinter
Caption = "Name:"
Height = 255
Index = 0
Left = 120
TabIndex = 8
Top = 360
Width = 735
End
Begin VB.Label lblPrinter
Caption = "Output Media:"
Height = 255
Index = 1
Left = 120
TabIndex = 7
Top = 1080
Width = 1095
End
Begin VB.Label lblPrinter
Caption = "Orientation:"
Height = 255
Index = 2
Left = 120
TabIndex = 6
Top = 720
Width = 975
End
Begin VB.Label lblPrinterSet
Height = 255
Index = 0
Left = 1440
TabIndex = 5
Top = 360
Width = 3375
End
Begin VB.Label lblPrinterSet
Height = 255
Index = 1
Left = 1440
TabIndex = 4
Top = 1080
Width = 3375
End
Begin VB.Label lblPrinterSet
Height = 255
Index = 2
Left = 1440
TabIndex = 3
Top = 720
Width = 3375
End
End
Begin VB.CommandButton cmdCancel
Caption = "&Cancel"
Height = 375
Left = 3840
TabIndex = 0
Top = 2040
Width = 1095
End
Begin MSComDlg.CommonDialog dlgCommon
Left = 2160
Top = 1320
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Attribute VB_Name = "frmPrintExport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public UserCancelled As Boolean
' Constant used by the Error handler function - DO NOT REMOVE
Const c_ModuleFileName = "frmPrintExport.frm"
Private Sub cmdCancel_Click()
On Error GoTo ErrorHandler
UserCancelled = True
Me.Hide
Exit Sub
ErrorHandler:
HandleError True, "cmdCancel_Click " & c_ModuleFileName & " " & GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1
End Sub
Private Sub CmdPrint_Click()
On Error GoTo ErrorHandler
UserCancelled = False
Me.Hide
Exit Sub
ErrorHandler:
HandleError True, "cmdPrint_Click " & c_ModuleFileName & " " & GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1
End Sub
Private Sub cmdPrinter_Click()
On Error GoTo ErrorHandler
Me.dlgCommon.CancelError = True
Me.dlgCommon.Flags = cdlPDPrintSetup
Me.dlgCommon.PrinterDefault = True
Me.dlgCommon.Flags = cdlPDPrintSetup Or cdlPDHidePrintToFile Or cdlPDNoPageNums
Me.dlgCommon.ShowPrinter
Printer.Orientation = Me.dlgCommon.Orientation
FillPrinterLabels
Exit Sub
ErrorHandler:
'user pressed cancel
Exit Sub
End Sub
Private Sub FillPrinterLabels()
Dim pPrinter As esriCore.IPrinter
Dim pPsPrnter As esriCore.IPsPrinter
Dim pPaper As esriCore.IPaper
Set pPrinter = New PsPrinter
Set pPaper = New Paper
On Error GoTo PrinterError
pPaper.PrinterName = Printer.DeviceName
Set pPrinter.Paper = pPaper
lblPrinterSet(0).Caption = pPaper.PrinterName
lblPrinterSet(1).Caption = pPrinter.Name
If (Printer.Orientation = 1) Then
lblPrinterSet(2).Caption = "Portrait"
Else
lblPrinterSet(2).Caption = "Landscape"
End If
Exit Sub
PrinterError:
Err.Clear
MsgBox "There is a problem setting up the printer." & vbCrLf & "Ensure that there is a printer installed on the system.", vbExclamation + vbOKOnly, "Printer Error"
End Sub
Private Sub Form_Activate()
On Error GoTo ErrorHandler
FillPrinterLabels
Exit Sub
ErrorHandler:
HandleError True, "Form_Activate " & c_ModuleFileName & " " & GetErrorLineNumberString(Erl), Err.Number, Err.Source, Err.Description, 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -