Dim dlg As New OpenFileDialog
Dim piv As WinForm.PictureViewer = e.Form.Controls("PictureViewer1")
dlg.Filter= "图形文件|*.bmp;*.jpg;*.gif"
If dlg.ShowDialog = DialogResult.OK Then
Dim pth As String = ProjectPath & "Attachments\\"
If dlg.FileName.ToLower.StartsWith(pth.ToLower) Then \'如果文件来自Attachments目录
piv.AddFile(dlg.FileName.SubString(pth.Length))
Else \'如果不是
FileSys.CopyFile(dlg.FileName, pth & FileSys.GetName(dlg.FileName))
piv.AddFile(FileSys.GetName(dlg.FileName))
End If
End If