要在cell里面画条直线代表业务的完成情况(百分制)
求一个思路

解决方案 »

  1.   

    处理DataGridView的CellPainting 事件就行了,如:
    DataGridView dv;
    dv.CellPainting += new DataGridViewCellPaintingEventHandler(dv_CellPainting);
    void dv_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
    {
    e.Graphics.DrawLine(SystemPens.ControlText, e.CellBounds.X, e.CellBounds.Y, e.CellBounds.Right, e.CellBounds.Bottom);
    }
      

  2.   

    我只是随便写的,你可以再参考下:
    private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
    {
    if (e.ColumnIndex == 2)
    {
    e.PaintBackground(e.CellBounds, true);
    e.PaintContent(e.CellBounds); Rectangle rect = new Rectangle(e.CellBounds.X, e.CellBounds.Y+(e.CellBounds.Height-5)/2, e.CellBounds.Width,5) ;
    e.Graphics.FillRectangle(SystemBrushes.ControlText, rect);
    //e.Graphics.DrawLine(SystemPens.ControlText, e.CellBounds.X, e.CellBounds.Y + e.CellBounds.Height / 2, e.CellBounds.Right, e.CellBounds.Y + e.CellBounds.Height / 2);
    e.Handled = true;
    }
    }