表A的双击事件:If User.IsRole("资料下载") Then '如果用户具有资料下载权限,则执行
If e.Col.Name = "文件名称及链接" Then
If e.Row.IsNull("文件名称及链接") = False Then
e.cancel = True
Dim c As Col = e.Col
Dim ftp As FTPClient = c.DataCol.FTPClient
Dim path As String = ProjectPath & "RemoteFiles\" & FileSys.GetName(e.Row(c.Name))
ftp.Download(e.Row(c.Name), path, True)
Dim proc As new Process
proc.File = path
proc.Start
End If
End If
Else
MessageBox.Show("你没有打开资料的权限!")
End If
表A的键盘事件:
If User.IsRole("资料下载") Then '如果用户具有资料下载权限,则执行
If e.Alt = True AndAlso e.KeyCode = Keys.S AndAlso e.Table.Current IsNot Nothing Then
If e.Table.Current Is Nothing Then Return
Dim c As Col = e.Table.Cols(e.Table.ColSel)
If c.name = "文件名称及链接" Then
Dim dlg As new SaveFileDialog
dlg.FileName = FileSys.GetName(e.Table.Current(c.Name))
If dlg.ShowDialog = DialogResult.OK Then
e.cancel = True
Dim ftp As FTPClient = c.DataCol.FTPClient
Dim path As String = ProjectPath & "RemoteFiles\" & FileSys.GetName(e.Table.Current(c.Name))
ftp.Download(e.Table.Current(c.Name), path, True)
FileSys.CopyFile(path, dlg.FileName, True)
msgbox("另存成功")
End If
End If
End If
Else
MessageBox.Show("你没有资料下载的权限!")
End If