我添加了一个柱状图控件Chart Control后,写了如下代码
void CACStatesQuery::SetChartData(double income, double expense)
{
//设定一组柱状图的列的个数为3个;
m_chart.SetColumnCount(3);
//设置柱状图上的数据
m_chart.GetDataGrid().SetData(1,1,income,(short)0);
m_chart.GetDataGrid().SetData(1,2,expense,(short)0);
m_chart.GetDataGrid().SetData(1,3,income-expense,(short)0);
//设置柱状图上列的名称,包含收支信息和收支余额
m_chart.SetColumn(1);
CString temp;
temp.Format("总收入(%.2f)",income);
m_chart.SetColumnLabel(temp);
m_chart.SetColumn(2);
temp.Format("总支出(%.2f)",expense);
m_chart.SetColumnLabel(temp);
m_chart.SetColumn(3);
temp.Format("收支余额(%.2f)",income-expense);
m_chart.SetColumnLabel(temp);
}
但是编译之后出现如下错误:
ompiling...
ACStatesQuery.cpp
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(129) : error C2027: use of undefined type 'CVcDataGrid'
g:\工作区\学习\毕业设计\accountdbss\mschart.h(18) : see declaration of 'CVcDataGrid'
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(129) : error C2228: left of '.SetData' must have class/struct/union type
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(130) : error C2027: use of undefined type 'CVcDataGrid'
g:\工作区\学习\毕业设计\accountdbss\mschart.h(18) : see declaration of 'CVcDataGrid'
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(130) : error C2228: left of '.SetData' must have class/struct/union type
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(131) : error C2027: use of undefined type 'CVcDataGrid'
g:\工作区\学习\毕业设计\accountdbss\mschart.h(18) : see declaration of 'CVcDataGrid'
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(131) : error C2228: left of '.SetData' must have class/struct/union type
Error executing cl.exe.AccountDBSS.exe - 6 error(s), 0 warning(s)请指点谢谢
void CACStatesQuery::SetChartData(double income, double expense)
{
//设定一组柱状图的列的个数为3个;
m_chart.SetColumnCount(3);
//设置柱状图上的数据
m_chart.GetDataGrid().SetData(1,1,income,(short)0);
m_chart.GetDataGrid().SetData(1,2,expense,(short)0);
m_chart.GetDataGrid().SetData(1,3,income-expense,(short)0);
//设置柱状图上列的名称,包含收支信息和收支余额
m_chart.SetColumn(1);
CString temp;
temp.Format("总收入(%.2f)",income);
m_chart.SetColumnLabel(temp);
m_chart.SetColumn(2);
temp.Format("总支出(%.2f)",expense);
m_chart.SetColumnLabel(temp);
m_chart.SetColumn(3);
temp.Format("收支余额(%.2f)",income-expense);
m_chart.SetColumnLabel(temp);
}
但是编译之后出现如下错误:
ompiling...
ACStatesQuery.cpp
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(129) : error C2027: use of undefined type 'CVcDataGrid'
g:\工作区\学习\毕业设计\accountdbss\mschart.h(18) : see declaration of 'CVcDataGrid'
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(129) : error C2228: left of '.SetData' must have class/struct/union type
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(130) : error C2027: use of undefined type 'CVcDataGrid'
g:\工作区\学习\毕业设计\accountdbss\mschart.h(18) : see declaration of 'CVcDataGrid'
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(130) : error C2228: left of '.SetData' must have class/struct/union type
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(131) : error C2027: use of undefined type 'CVcDataGrid'
g:\工作区\学习\毕业设计\accountdbss\mschart.h(18) : see declaration of 'CVcDataGrid'
G:\工作区\学习\毕业设计\AccountDBSS\ACStatesQuery.cpp(131) : error C2228: left of '.SetData' must have class/struct/union type
Error executing cl.exe.AccountDBSS.exe - 6 error(s), 0 warning(s)请指点谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货