Qprintinng Chart labels on printing page
Posted: Fri Mar 14, 2014 7:44 am
Hello, i have a question, when i print chart using TeeChart print preview dialog i can see, text quality is high, but the size of it is very small, so it looks like that for printing this chart TeeChart use to scale the specified size of chart to some special value, and after that print the big image to smaller area of print document, Is my assumption correct? if yes, couldn't you tell the optional proportion of the chart to get the same quality of text on printing chart, because i use this approach to draw my own print document with chart bitmap. Here you can see my code
but i can't say that i'm complitely satisfied with the result, so i nedd the proper proportions.
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.
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.