[求助] 求打印chart生成的柱状图代码
我是初学者,C#中用SoftwareFX.ChartFX.Lite.Chart生成的柱状图,我另加了一个打印button,程序要求点击“打印”按钮时,能实现打印柱状图的功能,如何编写代码?
回复 2楼 xydddaxia
我是初学者,我不太懂哎,我是把数据导入到chart1生成的柱状图下面是我的程序private void button15_Click(object sender, EventArgs e)
{
//PrintDocument pd = new PrintDocument();
printDocument2.PrintPage += new PrintPageEventHandler
(this.PrintImageHandler);
this.printDialog1.AllowSomePages = true;
this.printDialog1.ShowHelp = true;
printDialog1.Document = printDocument2;
DialogResult Rest = printDialog1.ShowDialog();
if (Rest == DialogResult.OK)
{
printDocument2.Print();
}
}
private void PrintImageHandler(object sender,PrintPageEventArgs ppeArgs)
{
Image curImage = chart1.GetChartBitmap();
Graphics g = ppeArgs.Graphics;
if (curImage != null)
{
// Draw Image using the DrawImage method
g.DrawImage(curImage, 100, 100,
curImage.Width, curImage.Height);
}
}
调试时出现错误说错误 “SoftwareFX.ChartFX.Lite.Chart”并不包含“GetChartBitmap”的定义 那你看我哪儿出错了?该怎么解决?