首先将图片添加到ImageList中
添加GridView中Column
void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
{
if (e.Column.FieldName == "image" && e.IsGetData)
{
try
{
if (e.Row != null)
{
Sys_Buttons buttons = e.Row as Sys_Buttons;
if (buttons != null)
{
Image image = imageList1.Images[buttons.IconCls];
e.Value =image;
} }
}
catch (NullReferenceException nullReferenceException)
{
FileLogUtility.Error(nullReferenceException);
}
} }