私はMONOC#でアプリケーションを作成していて、助けが必要です。私の問題は、Windows XPを実行しているサーバーから写真をロードする必要があり、写真のパスをどのように作成する必要があるかを知る必要があることです。つまり、Windowsはこのようなものです。
IOクラスを使用してストリームとしてロードし、すぐに閉じてファイルを解放します
コードは次のようなものです(これはC#のVBにあり、問題を説明したいのとほぼ同じです):
Public Sub FotoProducto(ByRef whichPicturebox As PictureBox)
Dim fsPicture As System.IO.FileStream
Dim sPath As String
'In windows I use this one and works fine
"\\MyServer\PhotoFolder\picture.jpg"
'in linux I supossed it would be:
sPath = "smb://MyServer/PhotoFolder/picture.jpg"
'I tried with local files and this code worked
sPath = "/home/user/images/sample.jpg"
'I don't know how to acces to files from others machines wich run WinXP
'using the console, That's the reson why I think I'm writing wrong the path,
'I've been looking in a lot of forums with no luck.
Try
fsPicture = New System.IO.FileStream(sPath , FileMode.Open, FileAccess.Read)
Adonde.Image = Image.FromStream(fsPicture)
fsPicture.Close()
fsPicture.Dispose()
Catch ex As Exception
whichPicturebox.Image = My.Resources.Defaultt
End Try
End Sub
私は本当に前もってあなたをたたきます