我在DataGridView属性Columns里添加了一个DataGridViewButtonColumn 
Name为BuySellBtnBuySell然后我现在在RowPostPaint事件中想动态改变Button的标题,然后我就
DataGridViewRow dgr = dgvBuySell.Rows[e.RowIndex]
dgr.Cells["BuySellBtnBuySell"].Value = "买入";
可是Button的标题没有变,请问怎么写才可以变?谢谢!

解决方案 »

  1.   

    很TMD郁闷,我的变了该button的文本显示为"买入"
      

  2.   

    我的button标题也是“买入”
      

  3.   

    private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
            {
                DataGridViewRow dgr = this.dataGridView1.Rows[e.RowIndex];
                dgr.Cells["Column1"].Value = "买入";
            }
    it is ok!why do not you fail?
      

  4.   

    foreach (DataGridViewRow dgr in dgvBuySell.Rows)
                    {
                        if (dgr.Index >= dgvBuySell.Rows.Count - 1)
                            return;
                        dgr.Cells["BuySellBtnBuySell"].Value = "买入";
                    }这样就不会变了
      

  5.   

    你这个不是在RowPostPaint事件中,当然不变。
      

  6.   

    还有,写在RowPostPaint事件里,运行程序后DataGridView狂闪,吓人哦!我现在都不敢用RowPostPaint事件了!
      

  7.   

    如果你将这个属性设置为true的话,将不会用Row上的内容显示文本....
    this.BuySellBtnBuySell.UseColumnTextForButtonValue = true;