Home > Software engineering >  Teechart in X and Y values in the access control has been wrong
Teechart in X and Y values in the access control has been wrong

Time:10-10

There is a problem in using TEECHART recently, I am a child dialog defines a TEECHART variables: m_chart1, then in the same dialog box for the m_chart1 defines a mousemove event, the mouse to get the coordinates of the points are correct, but at run time is always wrong, here is my code
Void CTchart1: : onm ouseMove (UINT nFlags, CPoint point)
{
CLineGraph * pDlg=(CLineGraph *) AfxGetApp ();
Int mPoint=1;
Double xValue=https://bbs.csdn.net/topics/((CSeries) pDlg -> m_chart1. Series (0)). XScreenToValue (point. X) + 0.5;
MPoint=(int) (xValue);
If (mPoint & lt; 0)
{
return;
}
CValueList xList=((CSeries) pDlg - & gt; M_chart1. Series (0)). Get_XValues ();
CValueList yList=((CSeries) pDlg - & gt; M_chart1. Series (0)). Get_YValues ();
Cstrings strXLabel=((CSeries) pDlg - & gt; M_chart1. Series (0)). Get_PointLabel (mPoint);
Int dYLabel=(int) yList. Get_Value (mPoint);
CToolList tlist=(CSeries) pDlg - & gt; M_chart1. Get_Tools ();
CTools tools=tlist. Get_Items (1);
CAnnotationTool anntool=view get_asAnnotation ();
Cstrings strTopNote;
StrTopNote. The Format (" point x=% d, point. The y=% d ", point, x, point, y);
Anntool. Put_Text (strTopNote);
The CWnd: : onm ouseMove (nFlags, point);
}
In which code runs to the "double xValue=https://bbs.csdn.net/topics/((CSeries) pDlg -> m_chart1. Series (0)). XScreenToValue (point. X) + 0.5;" This step will make a mistake, my language intuition is a sentence "CLineGraph * pDlg=(CLineGraph *) AfxGetApp ();" To obtain a class of the child dialogs: ClineGraph pointer to make a mistake, but the proper way to get child dialogs pointer I find for a long time but could not find, as we all know this is how to deal with?
  • Related