📄 duplex.frm
字号:
VERSION 5.00
Object = "{009541A3-3B81-101C-92F3-040224009C02}#3.2#0"; "Imgadmin.ocx"
Object = "{6D940288-9F11-11CE-83FD-02608C3EC08A}#2.8#0"; "Imgedit.ocx"
Object = "{84926CA3-2941-101C-816F-0E6013114B7F}#1.0#0"; "Imgscan.ocx"
Begin VB.Form frmDuplex
BorderStyle = 3 'Fixed Dialog
Caption = "双面扫描"
ClientHeight = 5595
ClientLeft = 2340
ClientTop = 2220
ClientWidth = 7770
ClipControls = 0 'False
Icon = "Duplex.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5595
ScaleWidth = 7770
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin ScanLibCtl.ImgScan ImgScan1
Left = 4560
Top = 4560
_Version = 65536
_ExtentX = 661
_ExtentY = 661
_StockProps = 0
DestImageControl= "ImgEdit1"
SelectedScanner = "No Scanner"
DefaultScanner = "No Scanner"
End
Begin VB.CommandButton cmdScanPages
Caption = "扫描背面"
Height = 375
Index = 1
Left = 5160
TabIndex = 6
Top = 3480
Width = 1215
End
Begin VB.CommandButton cmdScanPages
Caption = "扫描上面"
Height = 375
Index = 0
Left = 5160
TabIndex = 5
Top = 1560
Width = 1215
End
Begin VB.CommandButton cmdRestart
Caption = "重新扫描"
Height = 375
Left = 3960
TabIndex = 0
Top = 5040
Width = 975
End
Begin ImgeditLibCtl.ImgEdit ImgEdit1
Height = 5295
Left = 120
TabIndex = 3
TabStop = 0 'False
Top = 120
Width = 3615
_Version = 131080
_ExtentX = 6376
_ExtentY = 9340
_StockProps = 96
BorderStyle = 1
ImageControl = "ImgEdit11"
BeginProperty AnnotationFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
UndoBufferSize = 175657728
ForceFileLinking1x= -1 'True
sReserved1 = -3588
sReserved2 = -3588
bReserved1 = -1 'True
bReserved2 = -1 'True
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 6600
TabIndex = 2
Top = 5040
Width = 975
End
Begin VB.CommandButton cmdOK
Cancel = -1 'True
Caption = "确定"
Default = -1 'True
Height = 375
Left = 5400
TabIndex = 1
Top = 5040
Width = 975
End
Begin VB.Label lblInstructions
Caption = "2. 整理纸张扫描: 6, 4, 2.... 这扫描到另外一个临时文件. 两个临时工作文件自动合并, 形成一个正确文件。"
Height = 1095
Index = 1
Left = 3960
TabIndex = 8
Top = 2280
Width = 3495
End
Begin VB.Label lblInstructions
Caption = "1. 扫描正面页: 页 1, 3, 5.... 这将扫描到一个临时文件"
Height = 615
Index = 0
Left = 3960
TabIndex = 7
Top = 960
Width = 3615
End
Begin VB.Label lblOverview
Caption = "如果你机器有ADF进纸槽但不支持双页,使用这个功能"
Height = 735
Left = 3960
TabIndex = 4
Top = 120
Width = 3615
End
Begin AdminLibCtl.ImgAdmin ImgAdmin1
Left = 3960
Top = 4560
_Version = 196610
_ExtentX = 661
_ExtentY = 661
_StockProps = 0
PrintStartPage = 0
PrintEndPage = 0
ConvertICM = 0 'False
End
Begin VB.Menu mnuPage
Caption = "页面"
Begin VB.Menu mnuPageDirectionItem
Caption = "Pre&vious"
Index = 0
End
Begin VB.Menu mnuPageDirectionItem
Caption = "&Next"
Index = 1
End
Begin VB.Menu mnuPageDirectionItem
Caption = "&First"
Index = 2
End
Begin VB.Menu mnuPageDirectionItem
Caption = "&Last"
Index = 3
End
End
End
Attribute VB_Name = "frmDuplex"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'**************************************************************
' Module (Private) Variables
'**************************************************************
'----------------------------------------------------------
' File name, path name, and fully qualified path name.
'----------------------------------------------------------
Private mstrFileName As String
Private mstrPathName As String
Private mstrFullPathFileName As String
Private mlngPage As Long
'----------------------------------------------------------
' Workfile file names.
'----------------------------------------------------------
Private mstrDateTime As String 'Date/time constant
Private mstrTopPages As String 'Workfile A
Private mstrBottomPages As String 'Workfile B
Private mstrInterleavedPages As String 'A and B combined
Private Sub DisplayFile()
'**************************************************************
' PRIVATE SUB DisplayFile:
'**************************************************************
'----------------------------------------------------------
' Display the image using "Best Fit".
'----------------------------------------------------------
ImgEdit1.Image = mstrFullPathFileName 'Set file/path name.
ImgEdit1.Page = mlngPage 'Set page number.
ImgEdit1.FitTo 0 'Best Fit zoom factor.
ImgEdit1.Display 'Display the image.
'----------------------------------------------------------
' If an error occurred, declare a message box and exit
' the subroutine.
'----------------------------------------------------------
If ImgEdit1.StatusCode <> 0 Then
MsgBox Err.Description & " (ImgEdit error " & _
Hex(ImgEdit1.StatusCode) & ")", vbCritical
Exit Sub
End If
'----------------------------------------------------------
' Split the fully qualified path name into its two
' components: the path name and the file name. Then
' display the filename in the form caption.
'----------------------------------------------------------
mstrPathName = SplitPath(mstrFullPathFileName, "Path")
mstrFileName = SplitPath(mstrFullPathFileName, "File")
Me.Caption = mstrFileName & " - Duplex Scanning"
'----------------------------------------------------------
' Since an image is now displayed, enable the Page menu
' items based on displaying page 1.
'----------------------------------------------------------
mnuPageDirectionItem(0).Enabled = False 'Previous
mnuPageDirectionItem(2).Enabled = False 'First
If ImgEdit1.PageCount = 1 Then
mnuPageDirectionItem(1).Enabled = False 'Next
mnuPageDirectionItem(3).Enabled = False 'Last
Else
mnuPageDirectionItem(1).Enabled = True 'Next
mnuPageDirectionItem(3).Enabled = True 'Last
End If
End Sub
Private Sub InterleavePages(strTopPages As String, _
strBottomPages As String, strInterleavedPages As String)
'**************************************************************
' PRIVATE SUB InterleavePages: This will take 2 workfiles
' (one containing the top pages from a double-sided original
' (page order 1, 3, 5); the other containing the bottom pages
' (page order 6, 4, 2) and create a third file that contains
' all the pages. The pages will be interleaved so that the
' page order follows that of the original (1, 2, 3, 4, 5, 6).
'**************************************************************
'** Integers
Dim intIndex As Integer
'** Longs
Dim lngTopPage As Long
Dim lngTopPagesPageCount As Long
Dim lngBottomPage As Long
Dim lngBottomPagesPageCount As Long
'----------------------------------------------------------
' Find out how many pages are in each of the files.
'----------------------------------------------------------
ImgAdmin1.Image = strTopPages
lngTopPagesPageCount = ImgAdmin1.PageCount
ImgAdmin1.Image = strBottomPages
lngBottomPagesPageCount = ImgAdmin1.PageCount
'----------------------------------------------------------
' Declare an error if the two page counts are unequal.
'----------------------------------------------------------
If lngTopPagesPageCount <> lngBottomPagesPageCount Then
MsgBox WORKFILE_PAGES_UNEQUAL, vbExclamation
Exit Sub
End If
'----------------------------------------------------------
' Initialize the page numbers to begin at: the first page
' for the top pages, the last page for the bottom pages.
' Also, set the name of the new file.
'----------------------------------------------------------
lngTopPage = 1
lngBottomPage = ImgAdmin1.PageCount
ImgAdmin1.Image = strInterleavedPages
'----------------------------------------------------------
' Loop through the pages, interleaving them.
'----------------------------------------------------------
For intIndex = 1 To lngTopPagesPageCount
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -