我的代码:
dim vDataTable as DataTable
vDataTable=getsomething("select * from 表 where aaaaa",strConnect) '取得满足一定条件的数据
_flex.datasource=vDataTable '将数据绑定到FlexGrid
'然后根据条件变色
dim i as integer
for i=_flex.rows.fixed to _flex.rows.count-1
if _flex.getDataDisplay(i,"特单")="Y" then
dim cs as cellstyle
cs=_flex.styles.add("XX")
cs.backcolor=color.green
_flex.rows(i).style=cs
end if
next
查询后,显示的结果和变色都是正确的。
但排序后,变色的行还是原来的位置。
如果是对单元格进行设置图片的话,可以使用C1FlexGrid.SetCellImage方法或是C1FlexGrid.SetCellStyle方法。
这两个方法的语法为:
public void SetCellImage(int row, int col, Image newImage);
public void SetCellStyle(int row, int col, CellStyle newStyle);