我有一个datagridview
有一些 textboxtype 列和一个 checkboxtype 列。CheckBoxColumn 与 bool 类型属性绑定。
我希望如果选中复选框,它会在网格中看到,否则不会如图所示。
我在数据绑定完成中添加了一些代码,但它给出了编译时错误"Property or indexer 'System.Windows.Forms.DataGridViewCell.Visible' cannot be assigned to -- it is read only"
private void dgvleftEdit_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
var reportLogoList = cWShowInvoicePaymentDetailsBindingSource.List as IList<CWShowInvoicePaymentDetails>;
foreach (DataGridViewRow row in dgvleftEdit.Rows)
{
var objReport = row.DataBoundItem as CWShowInvoicePaymentDetails;
var findItem = from f in reportLogoList
//where f.fReportID == objReport.fKey
select f;
if (objReport.IsImage == false)
{
this.dgvleftEdit.Rows[row.Index].Cells[7].Visible = false;
}
else
{
this.dgvleftEdit.Rows[row.Index].Cells[7].Visible = true;
}
}
}
是否可以在 datagridview 中隐藏特定单元格?