Jump to content
Software FX Community
Sign in to follow this  

VC++ annotations not working

Recommended Posts

nicovil    0



I'm trying to add an annotation to my chart using VC++, but they are not showed at all on the chart.


I'm using this code snippet (VC++) using COM interface... m_chartPtr is the chart instance which is rendering perfect.


  Cfx62ClientServerAnnotation::_AnnotationXPtr annotx;      HRESULT rs = annotx.CreateInstance(__uuidof(Cfx62ClientServerAnnotation::AnnotationX));      if (rs == S_OK)      {        annotx->Enabled = TRUE;        Cfx62ClientServerAnnotation::_AnnotationTextPtr text;        rs = text.CreateInstance(__uuidof(Cfx62ClientServerAnnotation::AnnotationText));        annotx->List->Add(text);        if (rs == S_OK)        {          text->Attach(Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Near, 2, Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Far, 62);          text->TextColor = RGB(255, 0, 0);          text->Text = "Sample text";          text->Color = m_chartPtr->ColorFromArgb(0, 0, 0, 0);          text->Border->Color = m_chartPtr->ColorFromArgb(0, 0, 0, 0);          text->Orientation = 0;          text->Align = Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Far;          text->LineAlignment = Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Near;          text->Top = 40;          text->Left = 40;          rs = text->SizeToFit();          if (rs == S_OK)          {            VARIANT v;            V_VT(&v) = VT_DISPATCH;            V_DISPATCH(&v) = annotx;            m_chartPtr->Extensions->Add(v);          }        }      }


Is the code wrong?


Any help will be really appreciated!



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this