求助VC2005 中Teechart 控件画图的问题?
// Dlgsignal.cpp : 实现文件//
#include "stdafx.h"
#include "commtest1.h"
#include "Dlgsignal.h"
#include "commtest1Dlg.h"
// Dlgsignal 对话框
IMPLEMENT_DYNAMIC(Dlgsignal, CDialog)
Dlgsignal::Dlgsignal(CWnd* pParent /*=NULL*/)
: CDialog(Dlgsignal::IDD, pParent)
,m_tchart_Sig(0)//这里报错
, m_signalnumber(0)
{
}
Dlgsignal::~Dlgsignal()
{
}
void Dlgsignal::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//DDX_Control(pDX, IDC_TCHART1, m_teechart_signal);
DDX_Text(pDX, IDC_EDIT_SIGNALNUMBER, m_signalnumber);
DDX_Control(pDX, IDC_TCHART1, m_tchart_Sig);
}
BEGIN_MESSAGE_MAP(Dlgsignal, CDialog)
ON_BN_CLICKED(IDC_BUTTON_Drawsignal, &Dlgsignal::OnBnClickedButtonDrawsignal)
END_MESSAGE_MAP()
// Dlgsignal 消息处理程序
void Dlgsignal::OnBnClickedButtonDrawsignal()
{
// TODO: 在此添加控件通知处理程序代码
UpdateData(TRUE);
Ccommtest1Dlg commtest1dlg;
CString recievedate;
recievedate=commtest1dlg.m_RecieveData;
char*ch=new char[m_signalnumber*6];
// m_rFile.Write((LPCTSTR)commtest1dlg.m_RecieveData,m_RecieveData.GetLength());
ch=(LPSTR)(LPCTSTR)recievedate;
/////////////////////////////////////////////////////////////////////
// CSeries mycs = (CSeries)m_teechart_signal.Series(0);
//////////////////////////////////////////////////////////////////////
//FILE *pFile=fopen(lpzmpPath,"r");//数据文件
//char*ch=new char[m_signalnumber*6];
char*mid=new char[m_signalnumber*6];//NUM*6
//fread(ch,1,m_signalnumber*6,pFile);//串口数据为 20 1F 即一个AD采集的数据占用6个ASCII码(2个空格)
//fclose(pFile);
unsigned int*data=new unsigned int[m_signalnumber];
double*AD_V=new double[m_signalnumber];
int m=0;
for(int n=0;n<m_signalnumber*6;n++)
{
if(ch[n]<58)
{
mid[n]=ch[n]-48;
}
if(ch[n]>64)
{
mid[n]=ch[n]-55;
}
}
for(int n=0;n<m_signalnumber*6;n+=6)
{
data[m]=(mid[n])*16*16*16+(mid[n+1])*16*16+(mid[n+3])*16+mid[n+4];
m++;
}
for(int n=0;n<m_signalnumber;n++)//AD-将Ad转换结果转换为电压值
{
if(data[n]<32768)
{
AD_V[n]=(double)(data[n])*20.0/65536.0;
}
else
{
AD_V[n]=((double)(data[n])-65536.0)*20.0/65536.0;
}
m_tchart_Sig.Series(0).AddXY(n,AD_V[n],NULL,RGB(0,255,0)); //这里出错了
}
SetTimer(2,50,NULL);
delete[] ch,mid,data,AD_V;
}
1>Dlgsignal.cpp
1>.\Dlgsignal.cpp(23) : error C2664: 'CTchart1::CTchart1(const CTchart1 &)' : cannot convert parameter 1 from 'int' to 'const CTchart1 &'
1> Reason: cannot convert from 'int' to 'const CTchart1'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>.\Dlgsignal.cpp(104) : error C2228: left of '.AddXY' must have class/struct/union
1> type is 'LPDISPATCH'
1> did you intend to use '->' instead?