Jump to content
Software FX Community

MouseMove event and HitTest with Annotation in VC++


Recommended Posts


1. Could you show me C++ sample code how to use mousemove event and hittest with annotation ?I tested my sample code, but not works.I can't catch mouse event when annontation object is under the mouse.

I guess the mouse event is going to annotation object, but how can I catch it?

2. how to use SelectList

Cfx62Annotation::_AnnotationXPtr m_AnnotationPtr;m_AnnotationPtr.CreateInstance(__uuidof(Cfx62Annotation::AnnotationX));

VARIANT varExtension;V_VT(&varExtension) = VT_DISPATCH;V_DISPATCH(&varExtension) = m_AnnotationPtr;m_chartPtr->Extensions->Add(varExtension);

_AnnotationListBasePtr annotationPtr = m_AnnotationPtr->SelectionList;if(annotationPtr) {//annotation object is selected}else{//annotation object is not selected}

In above code,I think, I can get current annotation selectlist.but, even if there is no annotation object, SelectionList is not null.

How do I know any annotation is selected?SelectionList is _AnnotationListBasePtr and has no method, property.

Link to comment
Share on other sites

  • 3 months later...

You can implement the MouseMove Event as follows:

void C_AnnotationCircleDlg::OnMouseMoveChart1(LPDISPATCH sender, LPDISPATCH args)


 // TODO: Add your control notification handler code here

 _MouseEventArgsXPtr myArgs = (_MouseEventArgsXPtr)args;

 _AnnotationXPtr annotX = annot;

 if ( annotX != NULL )


_AnnotationObjectPtr pObj;

pObj = annotX->HitTest( myArgs->X, myArgs->Y );

if ( pObj != NULL )


 _GUID iid = __uuidof(_AnnotationCircle);

 IUnknown ** ptr = NULL;


 hr = pObj->QueryInterface(iid, (void **)&ptr);

 if ( !FAILED(hr) )


text->Visible = true;




 myArgs->Handled = true;



Please note that the above will work only if you have the annot->Enabled property set to "false".

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...