0

datagridview をロードする Windows フォーム アプリケーションがあります。列の 1 つは、画像ファイルへのハイパーリンクです。これらのリンクをクリックすると、以下に示すコードが実行されて画像が開きます。ただし、システムに新しいユーザーがいて、画像の表示に問題があります。

最初に、ユーザーがイメージ パス内のサブフォルダーの 1 つにアクセスできないことがわかりました。これが修正された後、ユーザーは完全なイメージ パスにアクセスし、Windows エクスプローラーからイメージを表示できるようになりました。

ただし、アプリケーションを実行してハイパーリンクをクリックすると、ユーザーは次のメッセージを受け取ります。

エラー: パス '\\Server\folder1\folder2\folder3\image.tif' へのアクセスが拒否されました。手順: FQImagingFilteredDataGridView_CellClick

何が起こっているのかについてのアイデアはありますか?ユーザーは、ディレクトリに対する完全な権限を持ち、個々の権限も含めて、Windows エクスプローラーで画像を正常に表示できるようになりましたが、アプリケーションは依然としてユーザーを拒否されたものとして扱います。

これが私のコードです:

Private Sub FQImagingFilteredDataGridView_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles FQImagingFilteredDataGridView.CellClick
    Try
        If e.RowIndex = -1 Then Exit Sub
        If e.ColumnIndex <> 0 Then Exit Sub
        Dim ImageFile As String = FQImagingFilteredDataGridView.CurrentRow.Cells("FILEPATH").Value.ToString & "\" & FQImagingFilteredDataGridView.CurrentRow.Cells("FILENAME").Value.ToString

        If Not IO.File.Exists(ImageFile) Then
            MsgBox("Image file not found - unable to display!", MsgBoxStyle.Information, "Attention!")
            Exit Sub
        End If

        ' Pass a memory stream version of image to ImageForm
        Dim DisplayImage As Image = LoadMemoryImage(ImageFile)
        If Not IsNothing(DisplayImage) Then
            Using ImageDisplayForm As New ImageForm(DisplayImage, ImageFile, True)
                With ImageDisplayForm
                    .Text = ImageFile.Substring(InStrRev(ImageFile, "\"))
                    .ShowDialog()
                End With
            End Using
        End If

    Catch ex As Exception
        MsgBox("Error: " + ex.Message + "  In Procedure:  " + Miscellaneous.InvokedBy(), MsgBoxStyle.Information, Me.Text)
    End Try
End Sub

任意の支援をいただければ幸いです。

4

0 に答える 0