类似财务凭证的栏目:摘要、借方、贷方这三栏。要求达到的效果:如果借方不为0,则 摘要栏中的文本居左
如果贷方不为0,则 摘要栏中的文本居右。 (注:同一行中,借、贷只能一栏有不为0的数据)我在onCustomDrawCell中搞了几种方法,总会报“Invalid class typecast"var cxColumn:TcxGridColumn;
begin
cxColumn:=(Sender as TcxGridDBTableView).GetColumnBYFieldName('JF'); //就这里报错 ....
end;请各位朋友指点一下,谢谢
如果贷方不为0,则 摘要栏中的文本居右。 (注:同一行中,借、贷只能一栏有不为0的数据)我在onCustomDrawCell中搞了几种方法,总会报“Invalid class typecast"var cxColumn:TcxGridColumn;
begin
cxColumn:=(Sender as TcxGridDBTableView).GetColumnBYFieldName('JF'); //就这里报错 ....
end;请各位朋友指点一下,谢谢
解决方案 »
- FastReprt想使用页眉,不是表头(pageHeader),有没有
- 好久没来了
- 原来能正常运行的代码在RAD2009中无法编译通过了,请高手帮忙看一下。
- [分享]移动窗体的小例子
- 先谢谢朋友们!请问tdbgrid的问题!
- 为什么DLL中的窗体显示控件的提示(即ShowHint=true)会出错?
- 我想用progressbar显示每次查询数据库的速度,如何知道查询所需时间?
- Delphi的画线问题,在线等,来者有分 !!!
- 我能用create database创建一个Access数据库吗?
- 用TADoDateSet如何得到表中最大字段值?
- 添加记录而不会和数据库里原来的记录重复,代码如何写,要详细的
- 从数据库读取数据添加到树形控件上~~~有适合答案我再加分~~~~~~~~标题不要太长~~~~~~~~~~~~~~~~~~~~~~~~~~~~~希望答案能详细些!
Cxgrid控件默認是將數據的數字形式是以居右對齊方式的,文本形式是以居左對齊方式的...你這個功能很簡單:
可直接在onCustomDrawCell事件中直接控制Cxgrid某列的以下屬性即可:在onCustomDrawCell事件中寫:...
AlignLeftVisible,//單元格居左
AlignRightVisible,//單元格居右
AlignCenterVisible,//單元格居中
...
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
CheckValue:Integer;
CxColumn:TcxGridDBColumn;
begin
inherited;
CxColumn:=(Sender as TcxGridDBTableView).GetColumnByFieldName('STATUS');
//加入你的條件
if CxColumn=nil then Exit;
if SameText(AViewInfo.Item.Name,CxColumn.Name) then
begin
CheckValue:=AViewInfo.GridRecord.Values[cxGrid2DBTableView1Column29.Index];
if(CheckValue=0) //and <//加入你的條件:借方不为0(同一行中,借、贷只能一栏有不为>then
begin
//滿足條件的單元格位置(居左)
end;
if(CheckValue=1) //and <//加入你的條件:贷方不为0(同一行中,借、贷只能一栏有不为>>then
begin
//滿足條件的單元格位置(居右)
end;
end;
end;