Page 1 of 1

Getting ChartRect.Top and ChartRect.Right ?

Posted: Wed Apr 06, 2005 3:41 pm
by 8576839
Hi,

I want to text out a string on the right top corner of my TeeChart.
Here is how I would have implemented it :

private void afterDrawChart(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
int title_width = (int) mChart.Graphics3D.TextWidth("Mon titre");
int x = mChart.Chart.ChartRect.Right - 4 - title_width;
int y = mChart.Chart.ChartRect.Top + 4;
mChart.Graphics3D.TextOut(100, 100, "Mon titre");
}

But this generates me the following error at compilation time:
D:\C#\TChartRapidity\Form1.cs(153): Cannot pass 'Steema.TeeChart.Chart.ChartRect' as ref or out, because 'Steema.TeeChart.Chart.ChartRect' is a marshal-by-reference class


How can I get the information about chartRect top and right position ?

Thanks by advance,
Verane.

Posted: Wed Apr 06, 2005 4:32 pm
by Pep
Hi Verane,

you can do :

Code: Select all

private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
	int title_width = (int) g.TextWidth("Mon titre"); 
	Rectangle cr = tChart1.Chart.ChartRect;
	g.TextOut(cr.Right - 4 - title_width, cr.Top + 4, "Mon titre"); 
}