如何将按钮添加到dataGridVeiw中的某些单元格
问题描述:
我有一个使用dataGridView的winForm应用程序.我想在列显示按钮中有某些单元格,而不是整个列.
如何将按钮添加到列中的某些单元格?
I have a winForm app that uses the dataGridView. I''d like to have certain cells within a column display buttons not the entire column.
How do I go about adding buttons to certain cells within a column?
答
为此,可以使用 ^ ].
要仅在某些单元格上具有按钮,应在创建的模板中编写逻辑.
例如,看看此为DataGridView控件 [ ^ ].在该示例中,所有单元格都是相似的,但是同样,这取决于您编写哪种逻辑
To do this, you can use CellTemplate[^] for the column.
To have buttons only on some cells, you should write the logic in the template you create.
For example, have a look at this Build a Custom RadioButton Cell and Column for the DataGridView Control[^] . In the example all the cells are similar, but again, it depends what kind of logic you write