1、项目中经常会在表格中插入按钮列,图片列,表格列一些非文本的特殊列。如何在devexpress表格控件gridcontrol中实现呢?以下列举一个实现添加图片列,按钮列,时间列,按钮列,开关列的示例,效果图如下:

devexpress表格控件gridcontrol图片列,按钮列,时间列等特殊列的实现

2、数据代码,其中图片列使用了两种方法,大家可根据自己要求变跟。

            Image img = Image.FromFile(Application.StartupPath+"\\img\\11111.png");//方法1
            //byte[] imgbyte=getImageByte("D:\\kkk.png");//方法2
            DataTable dt = new DataTable();
            dt.Columns.Add("A1");
            dt.Columns.Add("A2");
            dt.Columns.Add("A3");
            dt.Columns.Add("A4", typeof(Image));//方法1
            //dt.Columns.Add("A4",typeof(byte[]));//方法2
            dt.Columns.Add("A5");
            dt.Rows.Add(1, DateTime.Now, 1, img, 1);//方法1
            //dt.Rows.Add(1, DateTime.Now, 1, imgbyte, 1);//方法2
            gridControl1.DataSource = dt;

3、项目源码链接,下载链接(无需积分):http://download.csdn.net/detail/kehaigang29/8851075

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-08
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
相关资源
相似解决方案