Dim dlg As New OpenFileDialog Dim piv As WinForm.PictureViewer = e.Form.Controls("PictureViewer1") dlg.Filter= "图形文件|*.bmp;*.jpg;*.gif" dlg.MultiSelect = True If dlg.ShowDialog = DialogResult.OK Then For Each file as string In dlg.FileNames Tables("表A").AddNew Dim pth As String = ProjectPath & "Attachments\" If file.ToLower.StartsWith(pth.ToLower) Then '如果文件来自Attachments目录 piv.AddFile(file.SubString(pth.Length)) Else '如果不是 FileSys.CopyFile(file, pth & FileSys.GetName(file)) piv.AddFile(FileSys.GetName(file)) End If Next End If
|