文件附件里面文件类型有可能是图片也有可能是文档 怎么实现当是图片的时候就用PictureBox打开 反之就用WebBrowser打开
当前代码如下:(能够实现PictureBox WebBrowser同时打开图片 WebBrowser打开非图片类的文件 )
Dim pc2 As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim web1 As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
web1.Address = Nothing
If Tables("收文列表.文件附件").Current Is Nothing Then
Return
End If
Dim dr As DataRow = Tables("收文列表.文件附件").Current.DataRow
Dim fl As String = ProjectPath & dr("文件名")
If FileSys.FileExists(fl) AndAlso CRCCheckFile(fl) = dr.SQLGetValue("CRC值") Then '如果本地存在同名文件且CRC校验值相同
'则直接使用本地文件
web1.Address = fl
pc2.Image= GetImage(fl) 这个部分怎么写文件类型判断呢?
Else '否则从数据库提取文件
If dr.SQLLoadFile("附件",fl) = False Then '如果提取文件失败
Messagebox.Show("附件提取失败,可能并不存在附件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return
End If
End If
'Dim Proc As New Process '打开文件
'Proc.File = fl
'Proc.Start()