C#如何禁用Windows 窗体 DataGridView 控件的按钮列中的按钮

时间:2016-09-15 08:55:16
【文件属性】:
文件名称:C#如何禁用Windows 窗体 DataGridView 控件的按钮列中的按钮
文件大小:42KB
文件格式:RAR
更新时间:2016-09-15 08:55:16
DataGridView 控件的按钮列 代码示例演示如何自定义 DataGridViewButtonCell 类来显示可以显示为禁用的按钮。 本示例定义一个新的单元格类型 DataGridViewDisableButtonCell,它由 DataGridViewButtonCell 派生。 此单元格类型提供一个新的 Enabled 属性,可以将该属性设置为 false 来在单元格中绘制禁用的按钮。 本示例还定义一个新的列类型 DataGridViewDisableButtonColumn,它显示 DataGridViewDisableButtonCell 对象。 为了演示此新单元格类型和列类型,父 DataGridView 中的每个 DataGridViewCheckBoxCell 的当前值确定同一行中 DataGridViewDisableButtonCell 的 Enabled 属性是 true 还是 false。
【文件预览】:
testDataGridView
----testDataGridView.suo(22KB)
----testDataGridView.sln(890B)
----testDataGridView()
--------Form1.cs(8KB)
--------bin()
--------obj()
--------Properties()
--------Program.cs(497B)
--------testDataGridView.csproj(3KB)
--------Form1.Designer.cs(1KB)

网友评论

  • 可以实现功能