📄 frmfjgl.frm
字号:
VERSION 5.00
Object = "{A964BDA3-3E93-11CF-9A0F-9E6261DACD1C}#3.0#0"; "SetMe.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmFJGL
Caption = "附件管理"
ClientHeight = 6330
ClientLeft = 60
ClientTop = 345
ClientWidth = 10755
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6330
ScaleWidth = 10755
Begin ResizeLibCtl.ReSize ReSize1
Left = 5160
Top = 2970
_Version = 196608
_ExtentX = 741
_ExtentY = 741
_StockProps = 64
Enabled = -1 'True
FormMinWidth = 0
FormMinHeight = 0
FormDesignHeight= 6330
FormDesignWidth = 10755
End
Begin VB.Frame Frame2
Height = 6225
Left = 8370
TabIndex = 3
Top = 30
Width = 2340
Begin VB.CommandButton Command8
Caption = "删除"
Height = 465
Left = 480
TabIndex = 11
Top = 2280
Width = 1605
End
Begin VB.CommandButton Command7
Caption = "退出"
Height = 465
Left = 465
TabIndex = 10
Top = 2865
Width = 1605
End
Begin VB.CommandButton Command6
Caption = "修改"
Height = 465
Left = 465
TabIndex = 9
Top = 1680
Width = 1605
End
Begin VB.CommandButton Command5
Caption = "新增"
Height = 465
Left = 465
TabIndex = 8
Top = 1080
Width = 1605
End
End
Begin VB.Frame Frame1
Caption = "保单合同号"
Height = 6180
Left = 45
TabIndex = 0
Top = 60
Width = 8280
Begin VB.CommandButton Command4
Caption = "最后一张"
Height = 450
Left = 5775
TabIndex = 7
Top = 5550
Width = 1410
End
Begin VB.CommandButton Command3
Caption = "下一张"
Height = 450
Left = 4070
TabIndex = 6
Top = 5550
Width = 1410
End
Begin VB.CommandButton Command2
Caption = "上一张"
Height = 450
Left = 2365
TabIndex = 5
Top = 5550
Width = 1410
End
Begin VB.CommandButton Command1
Caption = "最前一张"
Height = 450
Left = 660
TabIndex = 4
Top = 5550
Width = 1410
End
Begin VB.PictureBox Picture2
Height = 5145
Left = 135
ScaleHeight = 5085
ScaleWidth = 7920
TabIndex = 1
Top = 255
Width = 7980
Begin MSComDlg.CommonDialog CommonDialog1
Left = 5070
Top = 2460
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Label Label2
Caption = "请双击“图片”选择图片"
ForeColor = &H00FF0000&
Height = 345
Left = 3330
TabIndex = 12
Top = 3780
Width = 3915
End
Begin VB.Image Image1
Height = 4770
Left = 180
Stretch = -1 'True
Top = 240
Width = 7695
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "图片"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 2115
Left = 2730
TabIndex = 2
Top = 1155
Width = 2655
End
End
End
End
Attribute VB_Name = "frmFJGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim pic() As Byte
Dim Filename As String
Dim BDHTH As String
Dim rsTemp As ADODB.Recordset
Dim picid As Long
Private Sub Command1_Click()
Dim msg As String
msg = FILLIMG(1)
End Sub
Private Sub Command2_Click()
Dim msg As String
msg = FILLIMG(2)
End Sub
Private Sub Command3_Click()
Dim msg As String
msg = FILLIMG(3)
End Sub
Private Sub Command4_Click()
Dim msg As String
msg = FILLIMG(4)
End Sub
Private Sub Command5_Click()
Dim rs As New ADODB.Recordset
rs.Open "fjgl", gCnn, adOpenStatic, adLockPessimistic
rs.AddNew
rs.Fields("bdhth") = BDHTH
If Filename = "" Then
MsgBox "请选择图片!!", vbInformation, "系统提示"
Exit Sub
Else
rs.Fields("tp") = pic
End If
rs.Update
Call Form_Load
End Sub
Private Sub Command6_Click()
If picid = 0 Then
MsgBox "不存在修改记录!!无法修改!!", vbInformation, "系统提示"
Exit Sub
End If
Dim rs As New ADODB.Recordset
rs.Open "select * from fjgl where id=" & picid, gCnn, adOpenStatic, adLockPessimistic
rs.Fields("tp") = pic
rs.Update
Call Form_Load
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Command8_Click()
If picid = 0 Then
MsgBox "没有要删除的记录!!", vbInformation, "系统提示"
Exit Sub
End If
gCnn.Execute "delete from fjgl where id=" & picid
Call Form_Load
End Sub
Private Sub Form_Load()
If Me.WindowState = 0 Then Me.Move 0, 0, 10875, 6840
'Dim rs As New ADODB.Recordset
Set rsTemp = New ADODB.Recordset
Dim strsql As String
Dim msg As String
BDHTH = frmYWEDIT.BDHTH
strsql = "select * from fjgl where bdhth='" & BDHTH & "' order by id"
rsTemp.Open strsql, gCnn, adOpenStatic, adLockReadOnly
If rsTemp.EOF Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
ElseIf rsTemp.RecordCount = 1 Then
msg = FILLIMG(1)
ElseIf rsTemp.RecordCount > 1 Then
msg = FILLIMG(1)
End If
End Sub
Function FILLIMG(i As Long) As String
'Dim rstemp As New ADODB.Recordset
'rstemp = rstemp
'Dim strsql As String
'strsql = "select * from fjgl where bdhth='" & BDHTH & "' order by id"
'rstemp.Open strsql, gCnn, adOpenStatic, adLockReadOnly
If i = 1 Then
rsTemp.MoveFirst
ElseIf i = 4 Then
rsTemp.MoveLast
ElseIf i = 2 Then
rsTemp.MovePrevious
ElseIf i = 3 Then
rsTemp.MoveNext
End If
If rsTemp.AbsolutePosition = 1 Then
If rsTemp.RecordCount = 1 Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Else
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = True
Command4.Enabled = True
End If
ElseIf rsTemp.AbsolutePosition = rsTemp.RecordCount Then
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = False
Command4.Enabled = False
ElseIf rsTemp.RecordCount = 1 Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Else
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End If
picid = rsTemp("id")
If Not rsTemp.EOF Then
If IsNull(rsTemp.Fields("tp").Value) = True Then
Image1.Picture = LoadPicture("")
Label1.Visible = True
pic = ""
Filename = ""
Else
pic = rsTemp.Fields("tp").Value
If Dir("temp.jpg") <> "" Then
Kill ("temp.jpg")
End If
Open "temp.jpg" For Binary As #1
Put #1, , pic
Close #1
Image1.Picture = LoadPicture("temp.jpg")
If Dir("temp.jpg") <> "" Then
Kill ("temp.jpg")
End If
Label1.Visible = False
End If
End If
End Function
Private Sub Image1_DblClick()
On Error GoTo ExitNow
Dim filedir As String
' Dim Filename As String
Dim fso As New FileSystemObject
Dim DestPFld As Scripting.Folder, DestFld As Scripting.Folder
CommonDialog1.Filter = "BitMaps|*.bmp|JPEG|*.jpg|GIF|*.gif"
CommonDialog1.FilterIndex = 2
CommonDialog1.DialogTitle = "选择源文件!"
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
Filename = CommonDialog1.Filename
Image1.Picture = LoadPicture(Filename)
'========保存图片===========
Open Filename For Binary As #1
If FileLen(Filename) = 0 Then
MsgBox "空图片!", vbInformation, "系统提示"
Else
ReDim pic(FileLen(Filename))
Label1.Visible = False
Get #1, , pic
End If
Close #1
'========保存图片===========
ExitNow:
' MsgBox Err.Description
End Sub
Private Sub Label1_DblClick()
Image1_DblClick
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -