
VB中如何用picture控件实现图片切换!谢谢!
同学们下去收集一些明星的照片,然后用VB编程切换明星脸。程序运行时,显示第一张明星照片,单击照片显示第二张,依次类推,单击最后一张切换到第一张。用Picture控件!谢了...
同学们下去收集一些明星的照片,然后用VB编程切换明星脸。程序运行时,显示第一张明星照片,单击照片显示第二张,依次类推,单击最后一张切换到第一张。
用Picture控件!谢了! 展开
用Picture控件!谢了! 展开
2个回答
展开全部
'=========遍历文件夹的函数=========
Public Function GetAllFiles(ByVal sPath As String)'
Dim item As String
'Dim oPaths As New Collection
item = Dir(sPath, vbDirectory)
While Len(item) > 0
If item <> "." And item <> ".." Then
If (GetAttr(FullPathName(sPath) & item) And vbDirectory) = vbDirectory Then
oPaths.Add item
Else
If IsModelFile(item) Then list.Add sPath & item
End If
End If
item = Dir
Wend
Dim p
For Each p In oPaths
Call GetAllFiles(Combin(sPath, p), list)
Next
End Function
'判断文件夹后是否有\
Public Function FullPathName(ByVal strPath As String) As String
FullPathName = IIf(VBA.Right(strPath, 1) = "\", strPath, strPath & "\")
End Function
'多个文件夹名组成路径
Public Function Combin(ParamArray arg()) As String
Dim X
Dim result As String
For Each X In arg()
result = result & FullPathName(X)
Next
Combin = result
End Function
'==============================
创建一个listbox为隐藏,名为oPaths
然后
'在form_load里
dim i as integer
i=1
'picture1〉click事件如下
sub
picture1.picture=loadpicture(opaths.list(i))i=i+1
end sub
运行时先调用GetAllFiles(路径,)
Public Function GetAllFiles(ByVal sPath As String)'
Dim item As String
'Dim oPaths As New Collection
item = Dir(sPath, vbDirectory)
While Len(item) > 0
If item <> "." And item <> ".." Then
If (GetAttr(FullPathName(sPath) & item) And vbDirectory) = vbDirectory Then
oPaths.Add item
Else
If IsModelFile(item) Then list.Add sPath & item
End If
End If
item = Dir
Wend
Dim p
For Each p In oPaths
Call GetAllFiles(Combin(sPath, p), list)
Next
End Function
'判断文件夹后是否有\
Public Function FullPathName(ByVal strPath As String) As String
FullPathName = IIf(VBA.Right(strPath, 1) = "\", strPath, strPath & "\")
End Function
'多个文件夹名组成路径
Public Function Combin(ParamArray arg()) As String
Dim X
Dim result As String
For Each X In arg()
result = result & FullPathName(X)
Next
Combin = result
End Function
'==============================
创建一个listbox为隐藏,名为oPaths
然后
'在form_load里
dim i as integer
i=1
'picture1〉click事件如下
sub
picture1.picture=loadpicture(opaths.list(i))i=i+1
end sub
运行时先调用GetAllFiles(路径,)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询