사람의 이름, 성, 코드 및 사진 인 사람 데이터가있는 테이블이 있습니다. 그리고 테이블에서 사람을 선택하고 DevExpress GridControl에 결과를 보내면 Name, Surname 및 Code 열이 표시됩니다. 그러나 Photo 열은 System.Byte [] 값을 모든 행에 표시합니다. 문제는 무엇입니까.DevExpress GridControl 이미지 열은 System.Byte []와 같은 이미지를 표시합니다.
3
A
답변
6
ColumnEdit 속성에 RepositoryItemPictureEdit의 인스턴스를 할당해야합니다. 이 경우 XtraGrid는 그리드에 이미지를 표시 할 수 있습니다.
샘플 : How to display an image in GridControl
관련 링크 :
0
*** 바이트 이미지로 변환
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);
d는 이것을 수행하는 방법에 대한 간단한 예제입니다 [http://www.devexpress.com/Support/Center/Example/Details/E3819](http://www.devexpress.com/Support/Center/Example/Details/E3819).) – wasyl