How do you put the picture in the database and picture the picture in the object?



  • I mean, how to bruise the photo (WPF/C#).



  • The images in the database are stored as a set of bikes, in general, they are understood without converting:

    <Image Name="Picture"
           Source="{Binding}">           
    </Image>
    

    However, it's a set of bikes, there's a nuance in the blank, and the picture itself needs to be converted into byte[] like:

    private byte[] set_bitmat(Bitmap bmp)
    {
        using (MemoryStream ms = new MemoryStream())
        {
             bmp.Save(ms, bmp.RawFormat);
             return ms.ToArray();
        }
    }
    

    And the result is to write to the database.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2