大家好:
如何在cxGrid 中动态创建band呢?详情见下图
说明:日期列是动态生成的。要生成相应的band ,band 的Caption 属性为日期所在该年的的周数。如2011-07-25对应的周期是第31周.所以Band的caption 显示为W31
thanks
如何在cxGrid 中动态创建band呢?详情见下图
说明:日期列是动态生成的。要生成相应的band ,band 的Caption 属性为日期所在该年的的周数。如2011-07-25对应的周期是第31周.所以Band的caption 显示为W31
thanks
解决方案 »
- 字符串 如何转换成 语音??
- 怎样从服务器的共享文件夹中copy文件?
- 用命令行sc create方式可以启动我的一个服务,如何在程序里面实现?命令行如下:
- 我需要用MouseMove事件来旋转图片,但不知道如何根据X,Y坐标来计算旋转角度,好像得使用ArcTan2函数
- Rave Reports 5.0 设计报表时,打印发票时的问题,
- ghao0(干什么) 来领分,欠债还钱,天经地义
- 如何从 DBGrid 里面提取出被选择的一行?
- 救救我这只菜鸟? 谢谢!
- 如果不使用DB系列控件。。。。
- 项目需求不清又必须动手做,有什么好办法可以减少以后的修改
- 动态创建控件问题,不能定位父控件,不明啊?
- 散分. 来谈谈Delphi XE4的试用感受
procedure TfrmYFMOCR10A.FormShow(Sender: TObject);
var
sSQL: string;
i: Integer;
cl: TcxGridDBBandEdColumn;
cb:TcxGridBand;
begin
inherited;
self.CompanyName.Caption := PrintCompanyName;
self.Title.Caption := PrintTitle;
sSQL:= PrintSql;
try
Qryprint.DisableControls;
if not Assigned(frmShowMsg) then
frmShowMsg := TfrmShowMsg.Create(Application);
frmShowMsg.Show;
frmShowMsg.Update;
Qryprint.Connection := DllAdoCn;
Qryprint.CommandTimeout :=500;
Qryprint.Close;
Qryprint.SQL.Clear;
Qryprint.SQL.Add(sSQL);
Qryprint.Open;
Screen.Cursor:=crHourGlass;
cxGrid1DBBandedTableView1.BeginUpdate;
try
for i:=7 to cxGrid1DBBandedTableView1.DataController.DataSet.FieldCount-1 do
begin
cb:=cxGrid1DBBandedTableView1.Bands.Add;
cb.Caption :=('W'+IntToStr(WeekOf(StrToDate(cxGrid1DBBandedTableView1.DataController.DataSet.Fields[i].FieldName))));
cl:=cxGrid1DBBandedTableView1.CreateColumn;
cl.DataBinding.FieldName:=cxGrid1DBBandedTableView1.DataController.DataSet.Fields[i].FieldName;
cl.DataBinding.Field.ReadOnly:=True;
cl.Position.BandIndex :=i-6;
end;
finally
cxGrid1DBBandedTableView1.EndUpdate;
end;
finally
Qryprint.EnableControls;
frmShowMsg.Close;
frmShowMsg.Free;
Screen.Cursor:=crDefault;
end;
end;