请教MFC 2005怎么把csv中的数据值以折线形式输出到Picture Control控件
请问MFC 2005如何把csv中的数据值以折线形式输出到Picture Control控件
以下代码是文件已打开每列存入b1[ ],b2[ ],b3[ ]三个数组中,TeeChart绘制折线就不需要了已解决,就是不知道如何才能在picture Control控件上绘制折线图。急需解决,谢谢
void CsofttaskDlg::OnBnClickedLoadButton()
{
// TODO: Add your control notification handler code here
TCHAR szFilter[] = _T("文本文件(*.csv)|*.csv|所有文件(*.*)|*.*||");
// 构造打开文件对话框
CFileDialog fileDlg(TRUE, _T("csv"), NULL, 0, szFilter, this);
CString strFilePath;
CStdioFile myFile;
// 显示打开文件对话框
if (IDOK == fileDlg.DoModal())
{
// 如果点击了文件对话框上的“打开”按钮,则将选择的文件路径显示到编辑框里
strFilePath = fileDlg.GetPathName();
SetDlgItemText(IDC_OPEN_EDIT, strFilePath);
int ItemCount=0;
if(myFile.Open(strFilePath,CFile::modeRead))
{
CString str,str1,str2,str3;
int ItemCount=0;
int temp;
while( myFile.ReadString(str))
{
ItemCount++;
AfxExtractSubString(str1,str,0,',');
temp= _ttoi(str1);
b1[ItemCount]=temp;
AfxExtractSubString(str2,str,1,',');
temp= _ttoi(str2);
b2[ItemCount]=temp;
AfxExtractSubString(str3,str,2,',');
temp= _ttoi(str2);
b3[ItemCount]=temp;
m_addData.InsertItem(ItemCount,str1);
m_addData.SetItemText(ItemCount-1, 0, str1);
m_addData.SetItemText(ItemCount-1, 1, str2);
m_addData.SetItemText(ItemCount-1, 2, str3);
}
myFile.Close();
}
}
}
------解决思路----------------------
获取各个点,然后LineTo等来画线
------解决思路----------------------
取的picture的hDC
使用hDC MoveTo、LineTo搞定
以下代码是文件已打开每列存入b1[ ],b2[ ],b3[ ]三个数组中,TeeChart绘制折线就不需要了已解决,就是不知道如何才能在picture Control控件上绘制折线图。急需解决,谢谢
void CsofttaskDlg::OnBnClickedLoadButton()
{
// TODO: Add your control notification handler code here
TCHAR szFilter[] = _T("文本文件(*.csv)|*.csv|所有文件(*.*)|*.*||");
// 构造打开文件对话框
CFileDialog fileDlg(TRUE, _T("csv"), NULL, 0, szFilter, this);
CString strFilePath;
CStdioFile myFile;
// 显示打开文件对话框
if (IDOK == fileDlg.DoModal())
{
// 如果点击了文件对话框上的“打开”按钮,则将选择的文件路径显示到编辑框里
strFilePath = fileDlg.GetPathName();
SetDlgItemText(IDC_OPEN_EDIT, strFilePath);
int ItemCount=0;
if(myFile.Open(strFilePath,CFile::modeRead))
{
CString str,str1,str2,str3;
int ItemCount=0;
int temp;
while( myFile.ReadString(str))
{
ItemCount++;
AfxExtractSubString(str1,str,0,',');
temp= _ttoi(str1);
b1[ItemCount]=temp;
AfxExtractSubString(str2,str,1,',');
temp= _ttoi(str2);
b2[ItemCount]=temp;
AfxExtractSubString(str3,str,2,',');
temp= _ttoi(str2);
b3[ItemCount]=temp;
m_addData.InsertItem(ItemCount,str1);
m_addData.SetItemText(ItemCount-1, 0, str1);
m_addData.SetItemText(ItemCount-1, 1, str2);
m_addData.SetItemText(ItemCount-1, 2, str3);
}
myFile.Close();
}
}
}
------解决思路----------------------
获取各个点,然后LineTo等来画线
------解决思路----------------------
取的picture的hDC
使用hDC MoveTo、LineTo搞定