Devexpress GridView 列中显示图片

首先将图片添加到ImageList中

添加GridView中Column

Devexpress GridView 列中显示图片

        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);

                }

            } 



        }

Devexpress GridView 列中显示图片

你可能感兴趣的:(DevExpress)