Howto get painting area right screen coordinate

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
bairog
Newbie
Newbie
Posts: 72
Joined: Fri Jul 07, 2006 12:00 am
Location: Moscow, Russia
Contact:

Howto get painting area right screen coordinate

Post by bairog » Fri Aug 07, 2009 12:36 pm

I have a chart and I whant to draw a horizontal line within chart painting area (I mean rectangle between axes) from left to right. Printing area left coordinate I can calculate as tChart1.Axes.Left.Position.
How can I get prinring area rigth coordinate?

BTW using tChart1.Axes.Right.Position returnes position even more left than tChart1.Axes.Left.Position :shock: and using tChart1.ClientRectangle.Right returnes right coordinate of whole chart but not painting area.
Thank you.

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

Re: Howto get painting area right screen coordinate

Post by Sandra » Mon Aug 10, 2009 10:47 am

Hello bairog,

I made a simple example that you can use in your application, using after draw event and chart rect. Please see next code and check that works as you want:

Code: Select all

     private void InitializeChart()
        {

            Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar.FillSampleValues();
            tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
                 
        }
        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            Rectangle rect = new Rectangle();
            //------Calculate depth position----------------//
            int wall1 = (int)((-(Math.Cos(60)) * (tChart1.Axes.Depth.IAxisSize)) + tChart1.Axes.Depth.Maximum);
            rect = tChart1.Chart.ChartRect;
            //-------If tChart.Aspect.view3D=true use wall1 but if false not.//
            if (tChart1.Aspect.View3D)
            {
                g.HorizontalLine(rect.Left, rect.Right + wall1, rect.Height / 2);
            }
            else
            {
                g.HorizontalLine(rect.Left, rect.Right, rect.Height / 2);
            }
        }
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

Post Reply