因为业务需要展示,在每行的数据最后一列显示一个按钮,点击按钮删除对应的数据。使用cxGrid能完美实现。

1、设置按钮列的properties是buttonedit

2、设置properties下的属性 viewStyle=vsButtonsAutoWidth

3、设置Options中的 ShowEditButtons=isebAlways

4、点击properties下的buttons按钮,弹出设置框,这里可以设置按钮的kind=bkText,此时按钮显示文本。

到此界面设置结束,现在我们需要给这个button增加点击事件。有两种方法:
一、在事件栏直接找到properties下的OnbuttonClick事件添加。
二、在这里重点介绍一下使用代码关联按钮事件