Code: Select all
private void OnPrint(object sender, PrintPageEventArgs ev)
{
Size chartOriginSize = m_TChart.Size;
Color panelColor = m_TChart.Chart.Panel.Color;
Color BackColor = m_TChart.Walls.Back.Color = Color.White; ;
m_TChart.AutoRepaint = false;
SetChartPrintProps(ev);
Font printFont = new Font("Arial", 15);
SizeF TitleSize = ev.Graphics.MeasureString(m_PrintName, printFont);
ev.Graphics.DrawImage(m_TChart.Bitmap, ev.MarginBounds.X, ev.MarginBounds.Y + TitleSize.Height + 10 + 11 * printFont.GetHeight(), ev.MarginBounds.Width, 400);
}
RestoreChartProps(ref chartOriginSize, ref panelColor, ref BackColor);
m_TChart.AutoRepaint = true;
}
private void SetChartPrintProps(PrintPageEventArgs ev)
{
m_TChart.Dock = DockStyle.None;
double width = ev.MarginBounds.Width * 1.5;// a bit of magic
double height = 400 * 1.5 ;
m_TChart.Size = new Size((int)width, (int)height);
m_TChart.Chart.Panel.Color = Color.White;
m_TChart.Chart.Panel.Gradient.Visible = false;
m_TChart.Walls.Back.Gradient.Visible = false;
m_TChart.BackColor = Color.White;
m_TChart.Panel.BorderRound = 1;
}
In other Case( probably preferable ), how can use standart TeeChart printing facilities, to move the chart drawing place for example to the top of a document, and to make all the background white( all the actions are made in my SetChartPrintProps function, except sizing ). Thanks.