For Each c As WinForm.Control In e.Form.Controls
If Typeof c Is WinForm.PictureViewer Then '判断控件是否是PictureViewer
Dim dlg As New OpenFileDialog '定义一个新的文件选择框
dlg.MultiSelect = False '不允许选择多个文件
dlg.Filter= "图形文件|*.jpg;*.jpeg" '筛选条件为图形文件
dlg.InitialDirectory = Vars("mulu") '打开对话框时,显示的目录为全局变量mulu中值
If dlg.ShowDialog = DialogResult.OK Then '用户点击确认后
Dim ls As String = FileSys.GetParentPath(dlg.FileName)&"\" '获取文件所在目录
If ls > "" Then
Vars("mulu") = ls '重新赋值全局变量mulu
End If
End If
End If
Next