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;
}
本文地址:http://com.8s8s.com/it/it45302.htm