如何将按钮添加到dataGridVeiw中的某些单元格 [英] How to add buttons to certain cells in dataGridVeiw

查看:109
本文介绍了如何将按钮添加到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


这篇关于如何将按钮添加到dataGridVeiw中的某些单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆