CSDN博客

img haibodotnet

编程抑制显示图表示例代码

发表于2003/11/16 10:45:00  3558人阅读

分类: 水晶报表 - 编程实例

using CrystalDecisions.CrystalReports.Engine;

private const string REPORT_NAME = @"../../CrystalReportAnalysis.rpt";
private const string CHART_OBJECT_NAME = @"Graph2";

private void Form1_Load(object sender, System.EventArgs e)
{
 report = new ReportDocument();
 report.Load(REPORT_NAME);
 report.Refresh();

 crvChart.ReportSource = report;
}

private void btnChangeType_Click(object sender, System.EventArgs e)
{
 ChartObject chart;
 
 chart = GetChartObject(CHART_OBJECT_NAME);
 chart.ObjectFormat.EnableSuppress = true;

 crvChart.RefreshReport();
}

private ChartObject GetChartObject(string reportObjectName)
{
 ChartObject chart;

 // 按名称获取 ReportObject,将其转换为 ChartObject,
 //并返回此对象。
 chart = report.ReportDefinition.ReportObjects[reportObjectName] as ChartObject;
 if (chart != null) return chart;
 else return null;
}

0 0

相关博文

我的热门文章

img
取 消
img