Getting ChartRect.Top and ChartRect.Right ?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Getting ChartRect.Top and ChartRect.Right ?

Post by Verane » Wed Apr 06, 2005 3:41 pm

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.

Pep
Site Admin
Site Admin
Posts: 3296
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Apr 06, 2005 4:32 pm

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"); 
}

Post Reply