MSChart的TwipsToChartPart问题.
请问
在vc6中使用mschart控件,得到鼠标位置(在控件中的坐标)后,就可以使用函数
TwipsToChartPart来获取该位置是mschart控件的哪一部分,如title, legend等,
但是笔者在使用这个函数时发现得到的位置代码总是0,不起作用,请问这是什么原因?
void CChartDlg::OnMouseMoveMschart1(short Button, short Shift, long X, long Y)
{
// TODO: Add your control notification handler code here
short whichPart = 0;
short whichSeries = 0;
short whichNumber = 0;
short nIndex3 = 0;
short nIndex4 = 0;
//.TwipsToChartPart X, Y, whichPart, whichSeries, whichNumber, 0, 0
m_Chart.TwipsToChartPart(X,Y,&whichPart, &whichSeries, &whichNumber, &nIndex3, &nIndex4);
CStatic* pStatic = (CStatic*)GetDlgItem(IDC_STATIC_XY);
CStatic* pStaticChart = (CStatic*)GetDlgItem(IDC_STATIC_CHART_XY);
char Array[10] = {0};
sprintf(Array,"%d,%d",X,Y);
pStatic->SetWindowText(Array);
pStatic->UpdateData(true);
sprintf(Array,"%d,%d,%d",whichPart,whichSeries,whichNumber);
pStaticChart->SetWindowText(Array);
pStaticChart->UpdateData(true);
pStaticChart=NULL;
}
如下,得到的 whichPart whichSeries whichNumber 都是0.
请问怎么解决?