陈玉才 发表于:2010-08-31 15:54:24
如何在窗体中显示图片,我的图片在另外一个文件夹中?
Private Sub Form_Current()
Dim strPath As String
strPath = CurrentProject.Path & "\器材图片" & Me.图片地址 & ".jpg"
If Dir(strPath) <> "" Then
Me.照片.Picture = strPath
Else
Me.照片.Picture = ""
End If
End Sub
与
Private Sub Form_Current()
Dim strPath As String
strPath = CurrentProject.Path & "\" & Me.图片地址 & ".jpg"
If Dir(strPath) <> "" Then
Me.照片.Picture = strPath
Else
Me.照片.Picture = ""
End If
End Sub
这两代码段只差别于& "\器材图片" & 与& "\" & ,前为2、图片与程序不同文件夹时,后为1、图片与程序同文件夹时。
Private Sub Form_Current()
Dim strPath As String
strPath = CurrentProject.Path & "\器材图片\" & Me.图片地址
If Dir(strPath) <> "" Then
Me.Image4.Picture = strPath
Else
Me.Image4.Picture = ""
End If
End Sub
与
Private Sub Form_Current()
Me.Image4.Picture = CurrentProject.Path & "\器材图片\" & Me.图片地址
End Sub
总记录:2篇 页次:1/1 9 1 :