В столбце изображения DevExpress GridControl отображаются изображения, например System.Byte []

У меня есть таблица с данными о людях: имя, фамилия, код и фото людей. И когда я выбираю людей из таблицы и отправляю результат в DevExpress GridControl, он показывает столбцы Имя, Фамилия и Код. Но в столбце Photo во всех строках отображается значение System.Byte []. В чем проблема.


person namco    schedule 23.08.2012    source источник


Ответы (2)


Вы должны присвоить свойству столбца ColumnEdit экземпляр RepositoryItemPictureEdit. В этом случае XtraGrid сможет отображать изображение в сетке.

Пример: Как отобразить изображение в GridControl

Ссылки по теме:

  1. Репозитории и элементы репозитория
  2. Обзор встроенных редакторов
person DmitryG    schedule 23.08.2012
comment
И вот даже прямой пример того, как это сделать http://www.devexpress.com/Support/Center/Example/Details/E3819 - person wasyl; 23.08.2012

*** Байт преобразовать в изображение

           data.Read();

            //get the value of the size field in the current row and store it in filesize

            int fileSize = data.GetInt32(data.GetOrdinal("size"));

            //get the value of the name field in the current row and store it in filesize

            string name = data.GetString(data.GetOrdinal("name"));  

            //Create a byte array to read the file in the row which is in bytes

            byte[] rawData = new byte[fileSize];

            //Read the bytes and store it in the array

            data.GetBytes(data.GetOrdinal("file"), 0, rawData, 0, fileSize);

            //Create the file from the byte array which is read from the database

            FileStream fs = new FileStream(name, FileMode.Create, FileAccess.Write);

            fs.Write(rawData, 0, fileSize);

            //closing the file stream 

            fs.Close();

            //Showing the image that is just retreived in te picturebox picDB

            picDB.BackgroundImage = new Bitmap(name);     
person Sumon Banerjee    schedule 27.01.2013