点击command1之后 image1随机载入 文件夹的任意一张图片 VB
①点击command1之后image1随机载入C:\DocumentsandSettings\Administrator\桌面\新建文件夹的任意一张图片②点击comman...
① 点击command1之后 image1随机载入 C:\Documents and Settings\Administrator\桌面\新建文件夹 的任意一张图片
② 点击command2 之后 弹出一个框 选择要载入图片的地址 选择好之后 图片出现在image2上
分别写出 ① 和 ②的 VB编程语句 展开
② 点击command2 之后 弹出一个框 选择要载入图片的地址 选择好之后 图片出现在image2上
分别写出 ① 和 ②的 VB编程语句 展开
展开全部
添加两个command ,两个image, 一个timer, 一个CommonDialog
①
Dim c
Dim sFile As String
Dim a()
Dim b
Private Sub Command1_Click()
sFile = Dir("C:\Documents and Settings\Administrator\桌面\新建文件夹\*")
Do While Len(sFile)
b = b + 1
ReDim Preserve a(0 To b)
a(b) = sFile
sFile = Dir()
Loop
c = c + 1
Image1.Picture = LoadPicture("C:\Documents and Settings\Administrator\桌面\新建文件夹\" & a(c))
If c >= b Then
c = 0
End If
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1 = True
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1 = False
End Sub
Private Sub Form_Load()
CommonDialog1.Filter = "JPEG Images(*.jpg;*.jpeg)|*.jpg;*.jpeg|"
Timer1.Interval = 10
Timer1 = False
End Sub
Private Sub Timer1_Timer()
Command1_Click
End Sub
②
Private Sub Command2_Click()
CommonDialog1.FileName = ""
CommonDialog1.ShowOpen
Image2.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
①
Dim c
Dim sFile As String
Dim a()
Dim b
Private Sub Command1_Click()
sFile = Dir("C:\Documents and Settings\Administrator\桌面\新建文件夹\*")
Do While Len(sFile)
b = b + 1
ReDim Preserve a(0 To b)
a(b) = sFile
sFile = Dir()
Loop
c = c + 1
Image1.Picture = LoadPicture("C:\Documents and Settings\Administrator\桌面\新建文件夹\" & a(c))
If c >= b Then
c = 0
End If
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1 = True
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1 = False
End Sub
Private Sub Form_Load()
CommonDialog1.Filter = "JPEG Images(*.jpg;*.jpeg)|*.jpg;*.jpeg|"
Timer1.Interval = 10
Timer1 = False
End Sub
Private Sub Timer1_Timer()
Command1_Click
End Sub
②
Private Sub Command2_Click()
CommonDialog1.FileName = ""
CommonDialog1.ShowOpen
Image2.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询