Page 1 of 1

How to customize the annotation tool programmatically (C++)?

Posted: Mon Jan 14, 2008 5:20 pm
by 9532558
Hi,

I'm using version 7.0.1.2 of TeeChart Pro ActiveX control. In one of my projects I'd like set the position, size, font, transparency and other parameters of the annotation tool from within my program. It is possible to customzie these parameters in the editor but how can I customize these parameters in my source code?
For the position I use

Code: Select all

m_myAnnotation.GetShape().SetLeft(someValue);
and

Code: Select all

m_myAnnotation.GetShape().SetTop(someValue);
but I didn't managed to adjust the width and height of the annotation. I'm missing member functions like

Code: Select all

m_myAnnotation.GetShape().SetWidth(), m_myAnnotation.GetShape().SetHeight()
or

Code: Select all

m_myAnnotation.GetShape().SetRight(), m_myAnnotation.GetShape().SetBottom()
. It should be possible to set these parameters because it works in the editor but how? Could you send me some example code? I'd also like to get example code for setting the font, font size, bevel, tranparency for the annotation tool.

Thanks,
Frank.

Posted: Tue Jan 15, 2008 10:35 am
by narcis
Hi Frank,
but I didn't managed to adjust the width and height of the annotation.
You need to use this:

Code: Select all

m_Chart1.GetTools().GetItems(0).GetAsAnnotation().SetWidth(myWidth);
	m_Chart1.GetTools().GetItems(0).GetAsAnnotation().SetHeight(myHeight);
I'd also like to get example code for setting the font, font size, bevel, tranparency for the annotation tool.
You can do it this way:

Code: Select all

	m_Chart1.GetTools().GetItems(0).GetAsAnnotation().SetText("hello world!");
	m_Chart1.GetTools().GetItems(0).GetAsAnnotation().GetShape().GetFont().SetName("Times New Roman");
	m_Chart1.GetTools().GetItems(0).GetAsAnnotation().GetShape().GetFont().SetSize(12);
	m_Chart1.GetTools().GetItems(0).GetAsAnnotation().GetShape().SetBevel(5);
	m_Chart1.GetTools().GetItems(0).GetAsAnnotation().GetShape().SetTransparency(50);
Also notice that you'll have to add the lines below to your code:

Code: Select all

#include "AnnotationTool.h"
#include "TeeShapePanel.h"
#include "TeeFont.h"

Posted: Tue Jan 15, 2008 2:05 pm
by 9532558
Hi Narcis,

thanks for your help. The text/font customization works fine. But still there is no SetWidth() and SetHeight() member function for the annotation tool in version 7.0.1.2 of the TeeChart control. Despite the fact that there is no such member function it should be possible to do these adjustments somehow since it is possible to do these adjustments in the editor.

How can I do these width/height adjustments in the source code in version 7.0.1.2?

Best regards,
Frank.

Posted: Tue Jan 15, 2008 2:58 pm
by narcis
Hi Frank,

Those properties are available in v7.0.1.4 which is latest TeeChart Pro v7 ActiveX release. Could you please try if this version works fine at your end?

Thanks in advance.

Posted: Wed Jan 16, 2008 2:24 am
by 9532558
Hi Narcis,

in v7.0.1.4 it works fine. :D

Thanks again,
Frank.