📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form form1
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "将图片存入数据库(方法一)"
ClientHeight = 6165
ClientLeft = 1755
ClientTop = 975
ClientWidth = 9360
ClipControls = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 6165
ScaleWidth = 9360
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command4
Caption = "退出"
Height = 360
Left = 5190
TabIndex = 12
Top = 5670
Width = 3960
End
Begin MSComDlg.CommonDialog CmD1
Left = 5220
Top = 390
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton command3
Caption = "..."
Enabled = 0 'False
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 260
Left = 4665
TabIndex = 11
TabStop = 0 'False
Top = 1230
Width = 260
End
Begin VB.Data Data1
Connect = "Access"
DatabaseName = "C:\00编程技巧\xcx\数据库\1将图片存入数据库\pic.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 1170
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "Sample Table"
Top = 5655
Width = 3765
End
Begin VB.TextBox Text1
DataField = "图片路径"
DataSource = "Data1"
Height = 300
Index = 2
Left = 975
TabIndex = 9
Top = 1200
Width = 3975
End
Begin VB.TextBox Text1
DataField = "作者"
DataSource = "Data1"
Height = 300
Index = 1
Left = 975
TabIndex = 8
Top = 660
Width = 3975
End
Begin VB.TextBox Text1
DataField = "图片名称"
DataSource = "Data1"
Height = 300
Index = 0
Left = 975
TabIndex = 7
Top = 180
Width = 3975
End
Begin VB.CommandButton Command2
Caption = "保存"
Enabled = 0 'False
Height = 345
Left = 6330
TabIndex = 1
Top = 930
Width = 1830
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 6330
TabIndex = 0
Top = 480
Width = 1815
End
Begin VB.Label Label3
Caption = "查看数据"
Height = 315
Left = 285
TabIndex = 10
Top = 5730
Width = 1725
End
Begin VB.Label Label2
Caption = "调用数据路径:"
Height = 270
Left = 4845
TabIndex = 6
Top = 1605
Width = 1755
End
Begin VB.Image Image2
Height = 3555
Left = 4845
Picture = "form1.frx":0000
Stretch = -1 'True
Top = 1920
Width = 4320
End
Begin VB.Label Label1
Caption = "图片"
Height = 270
Index = 3
Left = 210
TabIndex = 5
Top = 1620
Width = 870
End
Begin VB.Label Label1
Caption = "图片路径"
Height = 270
Index = 2
Left = 135
TabIndex = 4
Top = 1245
Width = 870
End
Begin VB.Label Label1
Caption = "图片作者"
Height = 270
Index = 1
Left = 120
TabIndex = 3
Top = 735
Width = 870
End
Begin VB.Label Label1
Caption = "图片名称"
Height = 300
Index = 0
Left = 120
TabIndex = 2
Top = 225
Width = 855
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
DataField = "图片"
DataSource = "Data1"
Height = 3555
Left = 225
Stretch = -1 'True
Top = 1920
Width = 4455
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\data.mdb"
Data1.RecordSource = "data"
End Sub
Private Sub Form_Activate()
Image2.Picture = LoadPicture(Text1(2).Text)
End Sub
Private Sub Command1_Click()
Data1.Recordset.AddNew
Data1.Enabled = False
command3.Enabled = True
Command2.Enabled = True
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Data1.Recordset.Update
Data1.Enabled = True
command3.Enabled = False
Command2.Enabled = False
Command1.Enabled = True
End Sub
Private Sub Command3_Click()
CmD1.DialogTitle = "选择图片"
CmD1.Filter = "bmp|*.bmp;*.ico"
CmD1.ShowOpen
If Len(CmD1.FileName) Then
Text1(2).Text = CmD1.FileName
Image1.Picture = LoadPicture(Text1(2).Text)
Image2.Picture = LoadPicture(Text1(2).Text)
End If
End Sub
Private Sub Data1_Reposition()
Image2.Picture = LoadPicture(Text1(2).Text)
End Sub
Private Sub Command4_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -