2017-07-13 17 views
0

私は解決のためにHereを調べましたが、datagridviewcellインスタンスに値が割り当てられているときにインデックスが外に出てしまい、paintのdatagridviewの関数が表示できなくなり、コードをロールバックする必要があります。winformでdatagridviewのセルを同じ値にマージするにはどうすればいいですか?

これは enter image description here

元のグリッドで、私はこれが原因で、私自身の答えであることが


enter image description here

答えて

0

How to Merge DataGridView Cell in Winformsenter link description here

ような何かになりたいですの間違いnot notic列と行のパラメータは、実際にセルペインティングとセルフォーマットから渡されます。これは完璧な答えです。

bool IsTheSameCellValue(int column, int row) 
{ 
    DataGridViewCell cell1 = dataGridView1[column, row]; 
    DataGridViewCell cell2 = dataGridView1[column, row - 1]; 
    if (cell1.Value == null || cell2.Value == null) 
    { 
     return false; 
    } 
    return cell1.Value.ToString() == cell2.Value.ToString(); 
} 
関連する問題