⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compress.frm

📁 扫描软件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
        For intIndex = 1 To 6
            cboCompressionType(intIndex).Enabled = False
            cboCompressionInfo(intIndex).Enabled = False
        Next intIndex
    End If
    
          
    Exit Sub
    
ShowErr:
    If frmMain.ImgScan1.StatusCode <> 0 Then
      MsgBox Err.Description + " - " + Str(Err), 16, "Error"
    Else
      MsgBox "VB Error " & Err.Description + " - " + Str(Err), 16, "Error"
    End If
    
    Resume Next

End Sub

Private Sub SetCompressionInformation()
'**************************************************************
' PRIVATE SUB SetCompressionInformation:
'**************************************************************
'** Integers
    Dim intCompressionInfo As Integer
    Dim intCompressionPreference As Integer
    Dim intCompressionType As Integer
    Dim intIndex As Integer
        
    On Error GoTo ShowErr
    
    '----------------------------------------------------------
    ' Get the Compression Preference, and use it to set the
    ' ListIndex of the cboCompressionPreference combo box.
    '----------------------------------------------------------
    intCompressionPreference = frmMain.ImgScan1.GetCompressionPreference
    cboCompressionPreference.ListIndex = intCompressionPreference
            
    '----------------------------------------------------------
    ' For each of the different image types...
    '----------------------------------------------------------
    For intIndex = 1 To 6
        '------------------------------------------------------
        ' Get the Compression Type, and use that to set the
        ' ListIndex of the cboCompressionType combo box.
        '------------------------------------------------------
        intCompressionType = frmMain.ImgScan1.GetPageTypeCompressionType(intIndex)

        Select Case intCompressionType
            Case 0  'No compression
                cboCompressionType(intIndex).ListIndex = 0
            Case 1  'Group 3 1D
                cboCompressionType(intIndex).ListIndex = 1
            Case 2  'Group 4 2D
                cboCompressionType(intIndex).ListIndex = 2
            Case 4  'TIFF Packbits
                cboCompressionType(intIndex).ListIndex = 3
            Case 8  'JPEG
                cboCompressionType(intIndex).ListIndex = 4
            Case 21 'LZW
                cboCompressionType(intIndex).ListIndex = 5
        End Select
        
        '------------------------------------------------------
        ' Get the Compression Info, and use that to set the
        ' ListIndex of the cboCompressionInfo combo box.
        '------------------------------------------------------
        intCompressionInfo = frmMain.ImgScan1.GetPageTypeCompressionInfo(intIndex)
        
        Select Case intCompressionInfo
            Case 0      'No compression, or Group 3 Modified Huffman, with reversed bit order
                If intCompressionType = 1 Then
                    cboCompressionInfo(intIndex).ListIndex = 1
                Else
                    cboCompressionInfo(intIndex).ListIndex = 0
                End If
            Case 512    'Group 4 2D, with reversed bit order
                cboCompressionInfo(intIndex).ListIndex = 2
            Case 2304   'Group 3 1D, with reversed bit order
                cboCompressionInfo(intIndex).ListIndex = 3
            Case 4096   'Group 3 Modified Huffman, no reversed bit order
                cboCompressionInfo(intIndex).ListIndex = 4
            Case 4608   'Group 4 2D, no reversed bit order
                cboCompressionInfo(intIndex).ListIndex = 5
            Case 6400   'Group 3 1D, no reversed bit order
                cboCompressionInfo(intIndex).ListIndex = 6
            Case 3870   'JPEG low resolution, high compression
                cboCompressionInfo(intIndex).ListIndex = 7
            Case 7740   'JPEG low resolution, medium compression
                cboCompressionInfo(intIndex).ListIndex = 8
            Case 11610  'JPEG low resolution, low compression
                cboCompressionInfo(intIndex).ListIndex = 9
            Case 20254  'JPEG medium resolution, high compression
                cboCompressionInfo(intIndex).ListIndex = 10
            Case 24124  'JPEG medium resolution, medium compression
                cboCompressionInfo(intIndex).ListIndex = 11
            Case 27994  'JPEG medium resolution, low compression
                cboCompressionInfo(intIndex).ListIndex = 12
            Case -21158 'JPEG high resolution, low compression
                cboCompressionInfo(intIndex).ListIndex = 13
            Case -25028 'JPEG high resolution, medium compression
                cboCompressionInfo(intIndex).ListIndex = 14
            Case -28898 'JPEG high resolution, high compression
                cboCompressionInfo(intIndex).ListIndex = 15
        End Select
    Next intIndex
    
    If intCompressionPreference = 3 Then   'Custom settings
        For intIndex = 1 To 6
            cboCompressionType(intIndex).Enabled = True
            cboCompressionInfo(intIndex).Enabled = True
        Next intIndex
    Else
        For intIndex = 1 To 6
            cboCompressionType(intIndex).Enabled = False
            cboCompressionInfo(intIndex).Enabled = False
        Next intIndex
    End If
    
          
    Exit Sub
    
ShowErr:
    If frmMain.ImgScan1.StatusCode <> 0 Then
      MsgBox Err.Description + " - " + Str(Err), 16, "Error"
    Else
      MsgBox "VB Error " & Err.Description + " - " + Str(Err), 16, "Error"
    End If
    
    Resume Next

End Sub

Private Sub cboCompressionInfo_Click(Index As Integer)
'**************************************************************
' PRIVATE SUB cboCompressionInfo_Click:
'**************************************************************

    Select Case cboCompressionInfo(Index).ListIndex
        Case 0  'No compression
            If cboCompressionType(Index).ListIndex = 0 Or _
                cboCompressionType(Index).ListIndex = 5 Then
            Else
                MsgBox "The compression type must be None or LZW.", vbInformation
            End If
    End Select
    
End Sub

Private Sub cboCompressionPreference_Click()
'**************************************************************
' PRIVATE SUB cboCompressionPreference_Click:  If "Custom
' Settings" is selected, enable the other combo boxes;
' otherwise, disable them.
'**************************************************************
'** Integers
    Dim intIndex As Integer

    If cboCompressionPreference.ListIndex = 3 Then  'Custom settings
        For intIndex = 1 To 6
            cboCompressionType(intIndex).Enabled = True
            cboCompressionInfo(intIndex).Enabled = True
        Next intIndex
    Else
        For intIndex = 1 To 6
            cboCompressionType(intIndex).Enabled = False
            cboCompressionInfo(intIndex).Enabled = False
        Next intIndex
    End If
    
End Sub

Private Sub cboCompressionType_Click(Index As Integer)
'**************************************************************
' PRIVATE SUB cboCompressionType_Click:
'**************************************************************

    Select Case Index
        Case 1          'Black and White
            Select Case cboCompressionType(Index).ListIndex
                Case 0, 1, 2, 3 'Uncompressed, Group 3 1D, Group 4 2D, TIFF Packbits are OK.
                Case Else
                    MsgBox "The compression type must be None, Group 3 1D, Group 4 2D, or TIFF Packbits.", vbInformation
            End Select
        Case 2, 4, 6    '16 Shades of Gray, 256 Colors, 16 Colors
            Select Case cboCompressionType(Index).ListIndex
                Case 0, 5       'Uncompressed, LZW are OK.
                Case Else
                    MsgBox "The compression type must be None or LZW.", vbInformation
            End Select
        Case 3, 5        '256 Shades of Gray, True Color (24-bit)
            Select Case cboCompressionType(Index).ListIndex
                Case 0, 4, 5    'Uncompressed, JPEG, LZW are OK.
                Case Else
                    MsgBox "The compression type must be None, JPEG, or LZW.", vbInformation
            End Select
    End Select
    
End Sub

Private Sub cmdClose_Click()
'**************************************************************
' PRIVATE SUB cmdClose_Click:  Unload the form.
'**************************************************************

    Unload Me
    
End Sub

Private Sub cmdGet_Click()
'**************************************************************
' PRIVATE SUB cmdGet_Click:  Get scanning compression
' information, using the GetCompressionPreference,
' GetPageTypeCompressionType, and GetPageTypeCompressionInfo
' methods.
'**************************************************************

    Call GetCompressionInformation
    
End Sub

Private Sub cmdScanOptions_Click()
'**************************************************************
' PRIVATE SUB cmdScanOptions:  Show the Scan Options dialog.
'**************************************************************

    frmMain.ImgScan1.ShowScanPreferences
    
End Sub

Private Sub cmdSet_Click()
'**************************************************************
' PRIVATE SUB SetCompressionInformation:
'**************************************************************
'** Integers
    Dim intCompressionInfo As Integer
    Dim intCompressionPreference As Integer
    Dim intCompressionType As Integer
    Dim intIndex As Integer
        
    On Error GoTo ShowErr
    
    '----------------------------------------------------------
    ' Set the Compression Preference, based on the ListIndex
    ' of the cboCompressionPreference combo box.  If it's not
    ' "Custom Settings" (value of 3), then set the compression
    ' options and exit the subroutine.
    '----------------------------------------------------------
    intCompressionPreference = cboCompressionPreference.ListIndex
    If intCompressionPreference <> 3 Then
        frmMain.ImgScan1.SetPageTypeCompressionOpts intCompressionPreference, 1, 0, 0
        Exit Sub
    End If
    
    '----------------------------------------------------------
    ' For each of the different image types...
    '----------------------------------------------------------
    For intIndex = 1 To 6
        '------------------------------------------------------
        ' Use the ListIndex of the cboCompressionType combo box
        ' to set the Compression Type.
        '------------------------------------------------------
        Select Case cboCompressionType(intIndex).ListIndex
            Case 0  'No compression
                intCompressionType = 0
            Case 1  'Group 3 1D
                intCompressionType = 1
            Case 2  'Group 4 2D
                intCompressionType = 2
            Case 3  'TIFF Packbits
                intCompressionType = 4
            Case 4  'JPEG
                intCompressionType = 8
            Case 5  'LZW
                intCompressionType = 21
        End Select
        
        '------------------------------------------------------
        ' Use the ListIndex of the cboCompressionInfo combo box
        ' to set the Compression Info.
        '------------------------------------------------------
        Select Case cboCompressionInfo(intIndex).ListIndex
            Case 0, 1   'No compression, or Group 3 Modified Huffman, with reversed bit order
                intCompressionInfo = 0
            Case 2      'Group 4 2D, with reversed bit order
                intCompressionInfo = 512
            Case 3      'Group 3 1D, with reversed bit order
                intCompressionInfo = 2304
            Case 4      'Group 3 Modified Huffman, no reversed bit order
                intCompressionInfo = 4096
            Case 5      'Group 4 2D, no reversed bit order
                intCompressionInfo = 4608
            Case 6      'Group 3 1D, no reversed bit order
                intCompressionInfo = 6400
            Case 7      'JPEG low resolution, high compression
                intCompressionInfo = 3870
            Case 8      'JPEG low resolution, medium compression
                intCompressionInfo = 7740
            Case 9      'JPEG low resolution, low compression
                intCompressionInfo = 11610
            Case 10     'JPEG medium resolution, high compression
                intCompressionInfo = 20254
            Case 11     'JPEG medium resolution, medium compression
                intCompressionInfo = 24124
            Case 12     'JPEG medium resolution, low compression
                intCompressionInfo = 27994
            Case 13     'JPEG high resolution, low compression
                intCompressionInfo = -21158
            Case 14     'JPEG high resolution, medium compression
                intCompressionInfo = -25028
            Case 15     'JPEG high resolution, high compression
                intCompressionInfo = -28898
            End Select
            
        frmMain.ImgScan1.SetPageTypeCompressionOpts intCompressionPreference, _
        intIndex, intCompressionType, intCompressionInfo
        
    Next intIndex
                  
    Exit Sub
    
ShowErr:
    If frmMain.ImgScan1.StatusCode <> 0 Then
      MsgBox Err.Description + " - " + Str(Err), 16, "Error"
    Else
      MsgBox "VB Error " & Err.Description + " - " + Str(Err), 16, "Error"
    End If
    
    Resume Next

End Sub

Private Sub Form_Load()
'**************************************************************
' PRIVATE SUB Form_Load:  Initialize the combo boxes, and then
' get the compression information.
'**************************************************************
'** Integers
    Dim intIndex As Integer

    cboCompressionPreference.AddItem "Best display quality"
    cboCompressionPreference.AddItem "Good display quality and small file size"
    cboCompressionPreference.AddItem "Smallest file size"
    cboCompressionPreference.AddItem "Custom settings"
   
    For intIndex = 1 To 6
        cboCompressionType(intIndex).AddItem "No compression"
        cboCompressionType(intIndex).AddItem "Group 3 1D"
        cboCompressionType(intIndex).AddItem "Group 4 2D"
        cboCompressionType(intIndex).AddItem "TIFF Packbits"
        cboCompressionType(intIndex).AddItem "JPEG"
        cboCompressionType(intIndex).AddItem "LZW"
    Next intIndex
    
    For intIndex = 1 To 6
        cboCompressionInfo(intIndex).AddItem ""
        cboCompressionInfo(intIndex).AddItem "Group 3 Modified Huffman, with reversed bit order"
        cboCompressionInfo(intIndex).AddItem "Group 4 2D, with reversed bit order"
        cboCompressionInfo(intIndex).AddItem "Group 3 1D, with reversed bit order"
        cboCompressionInfo(intIndex).AddItem "Group 3 Modified Huffman, no reversed bit order"
        cboCompressionInfo(intIndex).AddItem "Group 4 2D, no reversed bit order"
        cboCompressionInfo(intIndex).AddItem "Group 3 1D, no reversed bit order"
        cboCompressionInfo(intIndex).AddItem "JPEG low resolution, high compression"
        cboCompressionInfo(intIndex).AddItem "JPEG low resolution, medium compression"
        cboCompressionInfo(intIndex).AddItem "JPEG low resolution, low compression"
        cboCompressionInfo(intIndex).AddItem "JPEG medium resolution, high compression"
        cboCompressionInfo(intIndex).AddItem "JPEG medium resolution, medium compression"
        cboCompressionInfo(intIndex).AddItem "JPEG medium resolution, low compression"
        cboCompressionInfo(intIndex).AddItem "JPEG high resolution, low compression"
        cboCompressionInfo(intIndex).AddItem "JPEG high resolution, medium compression"
        cboCompressionInfo(intIndex).AddItem "JPEG high resolution, high compression"
    Next intIndex
        
    Call GetCompressionInformation
    
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -