da_frmScan.frm
上传用户:wyanru1974
上传日期:2022-08-09
资源大小:1315k
文件大小:16k
- VERSION 5.00
- Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
- Object = "{84926CA3-2941-101C-816F-0E6013114B7F}#1.0#0"; "IMGSCAN.OCX"
- Object = "{6D940288-9F11-11CE-83FD-02608C3EC08A}#2.1#0"; "IMGEDIT.OCX"
- Begin VB.Form da_frmScan
- BorderStyle = 3 'Fixed Dialog
- Caption = "扫描档案原文"
- ClientHeight = 6750
- ClientLeft = 1380
- ClientTop = 1050
- ClientWidth = 9390
- Icon = "da_frmScan.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6750
- ScaleWidth = 9390
- ShowInTaskbar = 0 'False
- Begin ScanLibCtl.ImgScan ImgScanyw
- Left = 4530
- Top = 90
- _Version = 65536
- _ExtentX = 1032
- _ExtentY = 820
- _StockProps = 0
- DestImageControl= "ImgEdityw"
- Image = "D:mwdadataimagebmp"
- FileType = 3
- PageType = 6
- CompressionType = 0
- CompressionInfo = 0
- ScanTo = 1
- End
- Begin VB.CommandButton cmdEdit
- Caption = "修改旧页"
- Enabled = 0 'False
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 6630
- TabIndex = 3
- Top = 180
- Width = 1215
- End
- Begin VB.CommandButton cmdDelete
- Caption = "删除旧页"
- Enabled = 0 'False
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 6630
- TabIndex = 5
- Top = 690
- Width = 1215
- End
- Begin VB.CommandButton cmdAdd
- Caption = "添加新页"
- Enabled = 0 'False
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 5250
- TabIndex = 2
- Top = 180
- Width = 1215
- End
- Begin VB.CommandButton cmdCancel
- Caption = "取消扫描"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 6630
- TabIndex = 8
- Top = 180
- Width = 1215
- End
- Begin VB.CommandButton cmdSetup
- Caption = "设置扫描仪"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 8010
- TabIndex = 6
- Top = 180
- Width = 1215
- End
- Begin VB.CommandButton cmdBrowse
- Caption = "浏览图象"
- Enabled = 0 'False
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 5250
- TabIndex = 4
- Top = 690
- Width = 1215
- End
- Begin VB.CommandButton cmdSearch
- Caption = "确定"
- Default = -1 'True
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 345
- Left = 3780
- TabIndex = 1
- Top = 210
- Width = 705
- End
- Begin MSComCtl2.UpDown UpDnpage
- Height = 375
- Left = 4050
- TabIndex = 9
- Top = 720
- Width = 270
- _ExtentX = 476
- _ExtentY = 661
- _Version = 393216
- Value = 1
- AutoBuddy = -1 'True
- BuddyControl = "cmdCancel"
- BuddyDispid = 196612
- OrigLeft = 1860
- OrigTop = 750
- OrigRight = 2130
- OrigBottom = 1095
- Max = 20
- Min = 1
- Enabled = 0 'False
- End
- Begin ImgeditLibCtl.ImgEdit ImgEdityw
- Height = 5355
- Left = 90
- TabIndex = 14
- Top = 1290
- Width = 9225
- _Version = 131073
- _ExtentX = 16272
- _ExtentY = 9446
- _StockProps = 96
- BorderStyle = 1
- ImageControl = "ImgEdityw"
- BeginProperty AnnotationFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- AutoRefresh = -1 'True
- UndoBufferSize = 134586368
- OcrZoneVisibility= -4044
- AnnotationOcrType= 88
- End
- Begin VB.TextBox txtpage
- BackColor = &H80000018&
- Enabled = 0 'False
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 315
- Left = 1590
- TabIndex = 12
- Top = 750
- Width = 2445
- End
- Begin VB.TextBox txtdh
- BackColor = &H80000018&
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 315
- Left = 1050
- TabIndex = 0
- Top = 210
- Width = 2715
- End
- Begin VB.CommandButton cmdClose
- Caption = "关闭"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 8010
- TabIndex = 10
- Top = 690
- Width = 1215
- End
- Begin VB.CommandButton cmdUpdate
- Caption = "开始扫描"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 5250
- TabIndex = 7
- Top = 180
- Width = 1215
- End
- Begin VB.Label Label2
- Caption = "当前图像页号:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 90
- TabIndex = 13
- Top = 780
- Width = 1425
- End
- Begin VB.Label Label1
- Caption = "当前档号:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 90
- TabIndex = 11
- Top = 240
- Width = 945
- End
- End
- Attribute VB_Name = "da_frmScan"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim mbEditFlag As Boolean
- Dim mbAddFlag As Boolean
- Dim mpath() As String
- Dim strsort As String
- Dim strywlj As String
- Dim mVal As Integer
- Private Sub SetButtons(bVal As Boolean)
- cmdAdd.Visible = bVal
- cmdEdit.Visible = bVal
- cmdUpdate.Visible = Not bVal
- cmdCancel.Visible = Not bVal
- cmdDelete.Visible = bVal
- CmdSetup.Visible = bVal
- cmdClose.Visible = bVal
- cmdSearch.Visible = bVal
- cmdBrowse.Visible = bVal
- txtdh.Enabled = bVal
- UpDnpage.Visible = bVal
- End Sub
- Private Sub cmdAdd_Click()
- mbAddFlag = True
- SetButtons False
- mVal = UpDnpage.Value
- txtpage.Text = "添加新图象页"
- End Sub
- Private Sub cmdCancel_Click()
- SetButtons True
- mbEditFlag = False
- mbAddFlag = False
- UpDnpage.Value = mVal
- End Sub
- Private Sub cmdClose_Click()
- Unload Me
- End Sub
- Private Sub cmdDelete_Click()
- On Error GoTo DeleteErr
- Dim mResult As Integer
- Dim oldpath As String
-
- mResult = MsgBox("确实要删除此图象页吗?", vbYesNo + vbQuestion, "删除")
- If mResult = vbYes Then
- oldpath = mpath(UpDnpage.Value - 1)
- strywlj = Replace(strywlj, oldpath & ";", "")
- strywlj = Replace(strywlj, oldpath, "")
- g_DBConnect.Execute "UPDATE da_jnwjb SET ywlj ='" & strywlj & "' WHERE sort1='" & strsort & "'"
- Kill g_ServerPath & "image" & oldpath
- mpath = Split(strywlj, ";")
- If UpDnpage.Max > 1 Then
- UpDnpage.Max = UpDnpage.Max - 1
- UpDnpage.Value = UpDnpage.Max
- ImgEdityw.Image = g_ServerPath & "image" & mpath(UpDnpage.Value - 1)
- Else
- cmdEdit.Enabled = False
- cmdDelete.Enabled = False
- cmdBrowse.Enabled = False
- UpDnpage.Enabled = False
- UpDnpage.Max = 0
- UpDnpage.Min = 0
- ImgEdityw.ClearDisplay
- End If
- End If
- Exit Sub
- DeleteErr:
- MsgBox Err.Description, vbOKOnly, "错误"
- End Sub
- Private Sub cmdEdit_Click()
- mbEditFlag = True
- SetButtons False
- mVal = UpDnpage.Value
- txtpage.Text = "修改图象页:" & CStr(UpDnpage.Value)
- End Sub
- Private Sub cmdSetup_Click()
- ImgScanyw.ShowSelectScanner
- ImgScanyw.ShowScanPreferences
- End Sub
- Private Sub cmdUpdate_Click()
- On Error GoTo UpdateErr
- Dim strpath As String
-
- If mbAddFlag Then
- strpath = Trim(txtdh) & "_" & CStr(UpDnpage.Max + 1) & ".BMP"
- ImgScanyw.Image = g_ServerPath & "image" & strpath
- ImgScanyw.ShowScanNew
- ImgScanyw.CloseScanner
- If Dir(g_ServerPath & "image" & strpath) <> "" Then
- If strywlj <> "" Then
- strywlj = strywlj & ";" & strpath
- Else
- strywlj = strpath
- End If
- g_DBConnect.Execute "UPDATE da_jnwjb SET ywlj ='" & strywlj & "' WHERE sort1='" & strsort & "'"
- mpath = Split(strywlj, ";")
- cmdEdit.Enabled = True
- cmdDelete.Enabled = True
- cmdBrowse.Enabled = True
- UpDnpage.Enabled = True
- ImgEdityw.Image = g_ServerPath & "image" & strpath
- UpDnpage.Max = UpDnpage.Max + 1
- UpDnpage.Min = 1
- UpDnpage.Value = UpDnpage.Max
- End If
- Else
- strpath = Trim(txtdh) & "_" & CStr(mVal) & ".BMP"
- ImgScanyw.Image = g_ServerPath & "image" & strpath
- ImgScanyw.ShowScanNew
- ImgScanyw.CloseScanner
- If Dir(g_ServerPath & "image" & strpath) <> "" Then
- ImgEdityw.Image = g_ServerPath & "image" & strpath
- UpDnpage.Value = mVal
- End If
- End If
- SetButtons True
- mbEditFlag = False
- mbAddFlag = False
- Exit Sub
- UpdateErr:
- MsgBox Err.Description, vbOKOnly, "错误"
- End Sub
- Private Sub Form_Load()
- If Not ImgScanyw.ScannerAvailable Then
- MsgBox "没有安装扫描仪,请安装扫描仪后再试!"
- cmdSearch.Enabled = False
- Else
- cmdSearch.Enabled = True
- End If
- End Sub
- Private Sub cmdSearch_Click()
- Dim rstjnwj As Recordset
- Dim QueryStr As String
- On Error GoTo ErrHandle
- If txtdh.Text = "" Then
- Exit Sub
- End If
- QueryStr = "SELECT qzh+'-'+mlh+'-'+ajh+'-'+yh as dh ,ywlj,sort1 FROM da_jnwjb " & _
- "WHERE qzh+'-'+mlh+'-'+ajh+'-'+yh='" & Trim(txtdh.Text) & "'"
- Set rstjnwj = New Recordset
- rstjnwj.Open QueryStr, g_DBConnect, adOpenStatic, adLockReadOnly
- If rstjnwj.BOF And rstjnwj.EOF Then
- MsgBox "找不到满足条件的记录!", vbOKOnly, "查找记录"
- cmdAdd.Enabled = False
- cmdEdit.Enabled = False
- cmdDelete.Enabled = False
- cmdBrowse.Enabled = False
- UpDnpage.Enabled = False
- txtpage.Text = ""
- strywlj = ""
- Else
- cmdAdd.Enabled = True
- strsort = rstjnwj("sort1") & ""
- strywlj = rstjnwj("ywlj") & ""
- If strywlj <> "" Then
- If InStr(strywlj, ".DOC") = 0 Then
- mpath = Split(strywlj, ";")
- cmdEdit.Enabled = True
- cmdDelete.Enabled = True
- cmdBrowse.Enabled = True
- UpDnpage.Enabled = True
- UpDnpage.Min = 1
- UpDnpage.Max = UBound(mpath) + 1
- UpDnpage.Value = 1
- ImgEdityw.ClearDisplay
- End If
- Else
- cmdEdit.Enabled = False
- cmdDelete.Enabled = False
- cmdBrowse.Enabled = False
- UpDnpage.Enabled = False
- UpDnpage.Min = 0
- UpDnpage.Max = 0
- ImgEdityw.ClearDisplay
- End If
- End If
- rstjnwj.Close
- Set rstjnwj = Nothing
- Exit Sub
- ErrHandle:
- MsgBox Err.Number & Err.Description
- End Sub
- Private Sub UpDnpage_Change()
- If UpDnpage.Value = 0 Then
- txtpage.Text = "无图象原文"
- Else
- txtpage.Text = CStr(UpDnpage.Value) & "/共 " & CStr(UBound(mpath) + 1) & " 页"
- End If
- End Sub
- Private Sub cmdbrowse_Click()
- Dim strpath As String
- strpath = g_ServerPath & "image" & mpath(UpDnpage.Value - 1)
- If Dir(strpath) <> "" Then
- ImgEdityw.ClearDisplay
- ImgEdityw.Image = g_ServerPath & "image" & mpath(UpDnpage.Value - 1)
- ImgEdityw.Display
- Else
- MsgBox "找不到图象文件!", vbOKOnly, "提示"
- End If
- End Sub