"Parameter is not valid" happened in TextOut() method

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
sim
Newbie
Newbie
Posts: 19
Joined: Wed Jul 30, 2008 12:00 am

"Parameter is not valid" happened in TextOut() method

Post by sim » Tue Feb 07, 2012 3:53 am

We develop an application in .Net 3.5 in VS 2010 c#, using TeeChart Pro v 3.5.3225.32185.
We have a function need the method:Tchart.Graphics3D.TextOut(10,5,"ABC").
But in the last two month wo have a exception about this twice,the log is:

System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, Single x, Single y, StringFormat format)
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.DoDrawString(Int32 x, Int32 y, String text, ChartBrush aBrush)
at Steema.TeeChart.Drawing.Graphics3D.TextOut(ChartFont f, Int32 x, Int32 y, String text)
at Steema.TeeChart.Drawing.Graphics3D.TextOut(Int32 x, Int32 y, String text)

And this is also hardly to be reproduced.We guess it maybe the Tchart has disposed the parameter which the DrawString need ,maybe is ChartFont.
So please to help to fixed this issue.
Thanks!

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: "Parameter is not valid" happened in TextOut() method

Post by Sandra » Tue Feb 07, 2012 4:14 pm

Hello Sim,

The problem is you need draw the Chart before use method TextOut. I have made a simple code that works fine for me and I think you can use to solve your problem, see next:

Code: Select all

  public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            tChart2.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart2_AfterDraw);
        }

        void tChart2_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            tChart2.Graphics3D.TextOut(10, 5, "ABC"); 
        }
Can you tell us if previous code works as you expect?
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

sim
Newbie
Newbie
Posts: 19
Joined: Wed Jul 30, 2008 12:00 am

Re: "Parameter is not valid" happened in TextOut() method

Post by sim » Thu Feb 09, 2012 5:40 am

Hello Sandra,

Thanks for your advice. I will try and hope the issue would be fixed.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: "Parameter is not valid" happened in TextOut() method

Post by Sandra » Fri Feb 10, 2012 12:47 pm

Hello sim,

I hope it, will be solved your problem :).

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply