MSChart的TwipsToChartPart问题.

dragonzxh 2006-04-04 10:31:15
请问

在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.
请问怎么解决?
...全文
258 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
dragonzxh 2006-04-04
  • 打赏
  • 举报
回复
再顶
dragonzxh 2006-04-04
  • 打赏
  • 举报
回复
自己再顶
dragonzxh 2006-04-04
  • 打赏
  • 举报
回复
是控件mschart的mousemove消息~~~
lixiaosan 2006-04-04
  • 打赏
  • 举报
回复
坐标系是否一样
dragonzxh 2006-04-04
  • 打赏
  • 举报
回复
自己顶`
菜牛 2006-04-04
  • 打赏
  • 举报
回复
OnMouseMove 中得到的是设备坐标。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧