VB 6 中 怎么读取Access数据库中的图片(数据类型OLE)
用的是Picturebox、CommonDialogCcmmandButton控件CcmmandButton的代码PrivateSubcmdSelectPhoto_Cli...
用的是Picturebox 、CommonDialog CcmmandButton控件
CcmmandButton的代码
Private Sub cmdSelectPhoto_Click()
On Error GoTo errHandler:
Dim mstrFileName As String
dlgSelect.DialogTitle = "选择该员工的照片"
dlgSelect.Filter = "所有图形文件|*.bmp;*.dib;*.gif;*.jpg;*.ico|位图文件(*.bmp;*.dib)|*.bmp;*.dib|GIF文件(*.gif)|*.gif|JPEG文件(*.jpg)|*.jpg|图标文件(*.ico)|*.ico"
dlgSelect.ShowOpen
If dlgSelect.FileName = "" Then Exit Sub
imgPhoto.Picture = LoadPicture(dlgSelect.FileName)
mstrFileName = dlgSelect.FileName
Exit Sub
errHandler:
MsgBox Err.Description, vbCritical, "错误"
End Sub 展开
CcmmandButton的代码
Private Sub cmdSelectPhoto_Click()
On Error GoTo errHandler:
Dim mstrFileName As String
dlgSelect.DialogTitle = "选择该员工的照片"
dlgSelect.Filter = "所有图形文件|*.bmp;*.dib;*.gif;*.jpg;*.ico|位图文件(*.bmp;*.dib)|*.bmp;*.dib|GIF文件(*.gif)|*.gif|JPEG文件(*.jpg)|*.jpg|图标文件(*.ico)|*.ico"
dlgSelect.ShowOpen
If dlgSelect.FileName = "" Then Exit Sub
imgPhoto.Picture = LoadPicture(dlgSelect.FileName)
mstrFileName = dlgSelect.FileName
Exit Sub
errHandler:
MsgBox Err.Description, vbCritical, "错误"
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询