C# 如何在ObjectListView中更改按钮背景色

C# 如何在ObjectListView中更改按钮背景色,c#,objectlistview,C#,Objectlistview,我有一个ObjectListView并设置了1列 IsButton=True 我想更改按钮的背景色,但无法设置 有人请帮我一下。我从objectlistview网站获得了下面的代码,请告诉我是否有用 要更改单个单元格的格式,需要将UseCellFormatEvents设置为true,然后侦听FormatCell事件。要以红色显示贷方余额,可以执行以下操作: private void olv1_FormatCell(object sender, FormatCellEventArgs e) {

我有一个ObjectListView并设置了1列

 IsButton=True
我想更改按钮的背景色,但无法设置


有人请帮我一下。

我从objectlistview网站获得了下面的代码,请告诉我是否有用

要更改单个单元格的格式,需要将UseCellFormatEvents设置为true,然后侦听FormatCell事件。要以红色显示贷方余额,可以执行以下操作:

private void olv1_FormatCell(object sender, FormatCellEventArgs e) {
    if (e.ColumnIndex == this.creditBalanceColumn.Index) {
        Customer customer = (Customer)e.Model;
        if (customer.Credit < 0)
            e.SubItem.ForeColor = Color.Red;
    }
}
private void olv1\u FormatCell(对象发送方,FormatCellEventArgs e){
如果(e.ColumnIndex==此.creditBalanceColumn.Index){
客户=(客户)e.Model;
如果(客户信用<0)
e、 SubItem.ForeColor=颜色为红色;
}
}

我从objectlistview网站获得了以下代码,请告诉我是否有用

要更改单个单元格的格式,需要将UseCellFormatEvents设置为true,然后侦听FormatCell事件。要以红色显示贷方余额,可以执行以下操作:

private void olv1_FormatCell(object sender, FormatCellEventArgs e) {
    if (e.ColumnIndex == this.creditBalanceColumn.Index) {
        Customer customer = (Customer)e.Model;
        if (customer.Credit < 0)
            e.SubItem.ForeColor = Color.Red;
    }
}
private void olv1\u FormatCell(对象发送方,FormatCellEventArgs e){
如果(e.ColumnIndex==此.creditBalanceColumn.Index){
客户=(客户)e.Model;
如果(客户信用<0)
e、 SubItem.ForeColor=颜色为红色;
}
}

谢谢你回答我的问题,我已经试过了,但是没有用。可能按钮栏和普通单元格不一样。谢谢你回答我的问题,我试过了,但没用。可能按钮列与普通单元格不同。