RT:delphi+cxgrid,連接sql顯示出數據,如何根據cxgrid單元格數據自繪顔色???
如:(當單元格的值等於1時,此單元格是紅色;2時是綠色;3時是黃色...)?
如:(當單元格的值等於1時,此單元格是紅色;2時是綠色;3時是黃色...)?
解决方案 »
- 服务程序中怎么用timer?
- 如何实现换行打印?
- 200分求 如何在1个目录中搜索多个文件!还有100分在Delphi VCL组件开发及应用中,在线等
- 很好拿的分,快來搶啊!
- 我想考北大青鸟的ACCP,请大家谈谈有没有必要。
- 窗体弹出太慢,于是又加一个窗体弹出显示“请等待”,但是label上的文字根本显示不出来
- 数据库中的日期型字段例如:2003-2-27 9:45:12,在程序中使用TDateTime型的变量显示到文本框中无论如何都出不来时间,只有日期,成了2003
- 请教各位大虾(高分相送,在线等待)
- 请帮我试一下这个软件,急!!!谢谢!
- 寻找Delphi高手
- inet_ntoa转换回來的IP地址,为什么是反的??
- cxbutton的黑色边框能去掉吗?
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
CheckValue:Integer;
aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk:string;
CxColumn,aa1,bb1,cc1,dd1,ee1,ff1,gg1,hh1,ii1,jj1,kk1:TcxGridDBBandedColumn;
begin
inherited; //程序自繪
CxColumn:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('FLAG');
if CxColumn=nil then Exit;
if SameText(AViewInfo.Item.Name,CxColumn.Name) then
begin
CheckValue:=StrToInt(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column28.Index]);
if(CheckValue=0) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=clRed;
end;
if(CheckValue=1) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=clGreen;
end;
if(CheckValue=2) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=clFuchsia;
end;
end;
aa1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XCB');
if aa1=nil then Exit;
if SameText(AViewInfo.Item.Name,aa1.Name) then
begin
aa:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column27.Index]);
if (Trim(aa)) <> (Trim(qry_approveyd.FieldByName('YCB').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
bb1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XBM');
if bb1=nil then Exit;
if SameText(AViewInfo.Item.Name,bb1.Name) then
begin
bb:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column1.Index]);
if (Trim(bb)) <> (Trim(qry_approveyd.FieldByName('YBM').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
cc1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XKB');
if cc1=nil then Exit;
if SameText(AViewInfo.Item.Name,cc1.Name) then
begin
cc:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column2.Index]);
if (Trim(cc)) <> (Trim(qry_approveyd.FieldByName('YKB').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
dd1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XZXB');
if dd1=nil then Exit;
if SameText(AViewInfo.Item.Name,dd1.Name) then
begin
dd:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column3.Index]);
if (Trim(dd)) <> (Trim(qry_approveyd.FieldByName('YZXB').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
ee1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XBMID');
if ee1=nil then Exit;
if SameText(AViewInfo.Item.Name,ee1.Name) then
begin
ee:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column13.Index]);
if (Trim(ee)) <> (Trim(qry_approveyd.FieldByName('YBMID').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
ff1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XBC');
if ff1=nil then Exit;
if SameText(AViewInfo.Item.Name,ff1.Name) then
begin
ff:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column14.Index]);
if (Trim(ff)) <> (Trim(qry_approveyd.FieldByName('YBC').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
kk1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XJZ');
if kk1=nil then Exit;
if SameText(AViewInfo.Item.Name,kk1.Name) then
begin
kk:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column15.Index]);
if (Trim(kk)) <> (Trim(qry_approveyd.FieldByName('YJZ').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
gg1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XZJQF');
if gg1=nil then Exit;
if SameText(AViewInfo.Item.Name,gg1.Name) then
begin
gg:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column16.Index]);
if (Trim(gg)) <> (Trim(qry_approveyd.FieldByName('YZJQF').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
hh1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XCBZX');
if hh1=nil then Exit;
if SameText(AViewInfo.Item.Name,hh1.Name) then
begin
hh:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column17.Index]);
if (Trim(hh)) <> (Trim(qry_approveyd.FieldByName('YCBZX').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
ii1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XGW');
if ii1=nil then Exit;
if SameText(AViewInfo.Item.Name,ii1.Name) then
begin
ii:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column18.Index]);
if (Trim(ii)) <> (Trim(qry_approveyd.FieldByName('YGW').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
jj1:=(Sender as TcxGridDBBandedTableView).GetColumnByFieldName('XZW');
if jj1=nil then Exit;
if SameText(AViewInfo.Item.Name,jj1.Name) then
begin
jj:=VarToStr(AViewInfo.GridRecord.Values[cxGrid1DBBandedTableView1Column19.Index]);
if (Trim(jj)) <> (Trim(qry_approveyd.FieldByName('YZW').AsString)) then
begin
AViewInfo.Focused;
ACanvas.Brush.Color:=$00B871FF;
end;
end;
end;