Coordinates

TeeChart for ActiveX, COM and ASP
Post Reply
Hermes
Newbie
Newbie
Posts: 54
Joined: Tue Feb 04, 2003 5:00 am
Location: Montevideo, Uruguay

Coordinates

Post by Hermes » Wed May 07, 2008 4:05 pm

How can I convert from teeChart screen coordinates to VisualBasic form screen coordinates?
I want to position a control in a form in a click on the teeChart.

thank you

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Thu May 08, 2008 9:26 am

Hi Hermes,

You could convert chart screen coordinates to form screen coordinates simply adding the chart's position to the desired coordinate. Something like this:

Code: Select all

FormXCoord = ChartXCoord + TChart1.Left
FormYCoord = ChartYCoord + TChart1.Top
But note that chart coordinates are expressed in pixels and the form in twips (15 pixels). So you should make your form count in pixels as follows:

Code: Select all

Me.ScaleMode = vbPixels
Or you could also count chart coordinates by 15 on 15:

Code: Select all

FormXCoord = ChartXCoord * 15 + TChart1.Left
FormYCoord = ChartYCoord * 15 + TChart1.Top
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply