📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5985
ClientLeft = 60
ClientTop = 345
ClientWidth = 7125
LinkTopic = "Form1"
ScaleHeight = 5985
ScaleWidth = 7125
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text2
DataField = "姓名"
DataSource = "Adodc1"
Height = 495
Left = 4680
TabIndex = 5
Text = "Text2"
Top = 5400
Width = 1335
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 720
Top = 5160
Width = 2415
_ExtentX = 4260
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Documents and Settings\myy\桌面\kwgl\admin.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Documents and Settings\myy\桌面\kwgl\admin.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "kw"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 4560
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "添加"
Height = 495
Left = 3840
TabIndex = 4
Top = 3960
Width = 975
End
Begin VB.CommandButton Command2
Caption = "添加"
Height = 495
Left = 2040
TabIndex = 3
Top = 3960
Width = 975
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
TabIndex = 2
Top = 720
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "图片"
Height = 375
Left = 2760
TabIndex = 0
Top = 2520
Width = 735
End
Begin VB.Label Label1
Caption = "姓名"
Height = 375
Left = 480
TabIndex = 1
Top = 720
Width = 975
End
Begin VB.Image Image1
Height = 2175
Left = 3960
Top = 1080
Width = 3015
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const blocksize = 100000
Dim numblocks As Integer
Dim filelength As Long
Dim leftover As Long
Dim i As Integer
Dim n As Integer
Dim bytedata() As Byte
Dim filename As String
Dim filenum As Integer
Dim diskfile As String
Private Sub Command1_Click()
With CommonDialog1
.Filter = "图片文件|*.bmp;*.jpg"
.ShowOpen
End With
If CommonDialog1.filename <> "" Then
Image1.Picture = LoadPicture(CommonDialog1.filename)
End If
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("姓名") = Trim(Text1.Text)
filename = Trim(CommonDialog1.filename)
Image1.Picture = LoadPicture(filename)
Me.MousePointer = vbHourglass
filenum = FreeFile()
Open filename For Binary Access Read As filenum
filelength = LOF(filenum)
If filelength = 0 Then
Close filenum
MsgBox "指定的图像文件不存在", 0, "信息提示"
Else
numblocks = filelength \ blocksize
leftover = filelength Mod blocksize
ReDim bytedata(leftover)
Get filenum, , bytedata()
Adodc1.Recordset("照片").AppendChunk bytedata()
ReDim bytedata(blocksize)
For i = 1 To numblocks
Get filenum, , bytedata()
Adodc1.Recordset("照片").AppendChunk bytedata()
Next i
Adodc1.Recordset("照片长度") = filelength
End If
Adodc1.Recordset.Update
MsgBox "chenggong", 0, "信息提示"
End Sub
Private Sub Form_Load()
diskfile = App.Path & "\image1.bmp"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -