hi,知道picturebox动态生成时候image怎么设置吗?picbox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));这个资源被内嵌,我想指定数据库制定的文件路径

解决方案 »

  1.   

    pictureBox1.Image=Image.FromFile("");
      

  2.   

    http://www.microsoft.com/china/MSDN/library/netFramework/netframework/Nfdnformswinforms02202003.mspx
      

  3.   

    Dim fileName As String = "a.gif"
                            If System.IO.File.Exists(fileName) Then
                                s = New System.IO.FileStream(fileName, IO.FileMode.Open)
                                Dim buf(s.Length) As Byte
                                s.Read(buf, 0, s.Length)
                                m = New System.IO.MemoryStream(buf)
                                pic.Image = System.Drawing.Image.FromStream(m)
                                s.Close()
                            End If
    Image.FromFile会锁定访问的文件,其他进程无法再访问该文件
    用内存流就不会了