在datagridview的行头,就是最左边的固定列,如何在行头单元格里显示图片呢?
希望高手分享你们的解决方案

解决方案 »

  1.   


    固定列难道不是普通的列马?ItemTemplate -> <img src="">
      

  2.   

    楼上的,看仔细了,是datagridview,而不是web form里的datagrid,在datagrid里没有固定列行头概念。
      

  3.   

    曾经试过这样重写事件,没有效果,还望高手指正
            Image delimage = 获取图片......
            protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
            {
               
                base.OnCellPainting(e);            HitTestInfo info = HitTest(e.CellBounds.Left, e.CellBounds.Top);
                if (e.RowIndex >= 0 && info.Type == DataGridViewHitTestType.RowHeader)
                {
                    e.Graphics.DrawImageUnscaled(delimage, e.CellBounds.Left, e.CellBounds.Top);            }
            }