很简单啊,假设Picture1中有一幅图片,单击它,复制到Picture2中
Private Sub Picture1_Click()
Picture2.Picture = Picture1.Picture
End Sub
你看看要不要得哈.其中:
=============================================
Dir1-目录列表控件
Drive1-驱动器列表控件
File1-文件列表控件
Image1-图像控件
Text1-文本框控件
Option1-单选控件(Caption为"通过单击浏览")
Option2-单选控件(Caption为"通过双击浏览")
=============================================
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo DriErr
Dir1.Path = Drive1.Drive
Exit Sub
DriErr:
If Err.Number = 68 Then
If MsgBox("请问要重试还是取消?", vbRetryCancel + vbCritical, "硬盘不存在或光驱没有插入磁盘!") = vbRetry Then
Resume 0
Else
Drive1.Drive = "C:"
Resume Next
End If
End If
End Sub
----------------------------------------------
Private Sub File1_Click()
If Option2.Value = True Then Exit Sub
Dim picFile As String
If Right(Dir1.Path, 1) = "\" Then
picFile = Dir1.Path + File1.FileName
Else
picFile = Dir1.Path + "\" + File1.FileName
End If
Image1.Picture = LoadPicture(picFile)
Text1.Text = picFile
End Sub
----------------------------------------------
Private Sub File1_DblClick()
If Option1.Value = True Then Exit Sub
Dim picFile As String
If Right(Dir1.Path, 1) = "\" Then
picFile = Dir1.Path + File1.FileName
Else
picFile = Dir1.Path + "\" + File1.FileName
End If
Image1.Picture = LoadPicture(picFile)
Text1.Text = picFile
End Sub