ReportBuilder + cxGrid = 错误:“画布不允许绘图”

dat*_*aol 2 delphi devexpress reportbuilder tcxgrid

是否有链接到同一DataSource 的cxGridReportBuilder报表。当我打印报告时,它显示错误:“画布不允许绘图”

这是我要解决的代码。

  Screen.Cursor := crHourGlass;
  cxGridModeloDBTableView1.DataController.DataSource := nil;
  try
    pprReportBuilder.Print;
  finally
    cxGridModeloDBTableView1.DataController.DataSource := dsModeloView;
    Screen.Cursor := crDefault;
  end;
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我通过其他方式解决这个问题吗?谢谢!

Gui*_*ens 5

我的猜测是 ReportBuilder 正在导航数据集以创建报告,但 cxGrid 并不期望如此。

不要解耦数据源,而是尝试使用cxGrid.BeginUpdateand cxGrid.EndUpdatebefore 和 afterpprReportBuilder.Print像这样:

  Screen.Cursor := crHourGlass;
  cxGridModeloDBTableView1.BeginUpdate;
  try
    pprReportBuilder.Print;
  finally
    cxGridModeloDBTableView1.EndUpdate;
    Screen.Cursor := crDefault;
  end;
Run Code Online (Sandbox Code Playgroud)

华泰