Skocz do zawartości

Biblioteka załączników, wzorzec wydruku

Polecane posty

  • 1 miesiąc temu...

Dzień dobry,

aby dodać zdjęcie z biblioteki załączników w sekcji Code, należałoby dodać:

using InsERT.Moria.Wydruki;
using System.IO.Compression;
using System.IO;

Następnie dodać dwie metody:

private byte[] DecompressedByte(byte[] content)
{
    byte[] decompressedBytes = new byte[content.Length];
    using (var ms = new MemoryStream(content))
    {
        using (var input = new DeflateStream(ms, CompressionMode.Decompress))
        {
            input.Read(decompressedBytes, 0, content.Length);
        }
    }
    return decompressedBytes;
}
 

public Image byteArrayToImage(byte[] byteArrayIn)
{
    using(MemoryStream ms = new MemoryStream(DecompressedByte(byteArrayIn)))
    {
        Image returnImage = Image.FromStream(ms);
        return returnImage;
    }
}

W kolejnym kroku dodać obiekt Dane.

image.png.5684e37fbf816997d7cf26a9f1f96f61.png

W ostatnim kroku dodać na wzorcu wydruku Składnik - Image, używając metody byteArrayToImage.

image.png.1f827facbf21181886096ce5c853aed2.png

Rezultatem powyższych czynności będzie grafika z biblioteki załączników asortymentu.

image.png.e922a8dd54a115eba1160351c93f0177.png

image.png.9913afb2a51e0a56c93e4c2356a47f81.png

Link to postu
×
×
  • Dodaj nową pozycję...