问题描述
- vc++6.0 中teechart不懂之处
- BOOL CCccDlg::OnInitDialog()
{
CDialog::OnInitDialog();
AfxEnableControlContainer();
COleDateTime now=COleDateTime::GetCurrentTime();//得到当前的时间
CString strDate=now.Format(""%Y-%m-%d"");//得到日期
CString strTime=now.Format(""%H:%M:%S"");//得到时间
SetDlgItemText(IDC_EDIT1strDate);
SetDlgItemText(IDC_EDIT2strTime);
SetTimer(11000NULL);//计置计时器m_Grid1.SetExtendedStyle(LVS_EX_FLATSB |LVS_EX_FULLROWSELECT |LVS_EX_HEADERDRAGDROP |LVS_EX_ONECLICKACTIVATE |LVS_EX_GRIDLINES);m_Grid1.InsertColumn(0日期""LVCFMT_LEFT1300);m_Grid1.InsertColumn(1时间""LVCFMT_LEFT1301);m_Grid1.InsertColumn(2炉号""LVCFMT_LEFT1302); m_Grid1.InsertColumn(3钢种""LVCFMT_LEFT1303);m_Grid1.InsertColumn(4班组""LVCFMT_LEFT1304);m_Grid1.InsertColumn(5炉龄""LVCFMT_LEFT1305);m_Grid1.InsertColumn(6计算动态吹氧量""LVCFMT_LEFT1306);m_Grid1.InsertColumn(7计算冷却剂加入量""LVCFMT_LEFT1307);m_Grid1.InsertColumn(8钢水碳含量推定值""LVCFMT_LEFT1308);m_Grid1.InsertColumn(9钢水温度推定值""LVCFMT_LEFT1309);m_Grid1.InsertColumn(10实际动态吹氧量""LVCFMT_LEFT13010);m_Grid1.InsertColumn(11实际冷却剂加入量""LVCFMT_LEFT13011);m_Grid1.InsertColumn(12实际终点碳含量""LVCFMT_LEFT13012);m_Grid1.InsertColumn(13实际终点钢水温度""LVCFMT_LEFT13013);m_Grid1.InsertColumn(14脱碳系数α""LVCFMT_LEFT13014);m_Grid1.InsertColumn(15脱碳系数β""LVCFMT_LEFT13015);m_Grid1.InsertColumn(16升温系数γ""LVCFMT_LEFT13016);m_Grid1.InsertColumn(17升温系数δ""LVCFMT_LEFT13017);ADO m_Ado;m_Ado.OnInitADOConn();//连接数据库CString SQL = ""select * from Dynamic order by 日期 desc""; //设置查询字符串m_Ado.m_pRecordset = m_Ado.OpenRecordset(SQL);//打开记录集while(!m_Ado.m_pRecordset->adoEOF){ m_Grid1.InsertItem(0"); m_Grid1.SetItemText(00(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""日期"")); m_Grid1.SetItemText(01(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""时间"")); m_Grid1.SetItemText(02(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""炉号"")); m_Grid1.SetItemText(03(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""钢种"")); m_Grid1.SetItemText(04(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""班组"")); m_Grid1.SetItemText(05(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""炉龄"")); m_Grid1.SetItemText(06(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""计算动态吹氧量"")); m_Grid1.SetItemText(07(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""计算冷却剂加入量"")); m_Grid1.SetItemText(08(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""钢水碳含量推定值"")); m_Grid1.SetItemText(09(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""钢水温度推定值"")); m_Grid1.SetItemText(010(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""实际动态吹氧量"")); m_Grid1.SetItemText(011(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""实际冷却剂加入量"")); m_Grid1.SetItemText(012(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""实际终点碳含量"")); m_Grid1.SetItemText(013(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""实际终点钢水温度"")); m_Grid1.SetItemText(014(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""脱碳系数α"")); m_Grid1.SetItemText(015(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""脱碳系数β"")); m_Grid1.SetItemText(016(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""升温系数γ"")); m_Grid1.SetItemText(017(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect(""升温系数δ"")); m_Ado.m_pRecordset->MoveNext();//将记录集指针移动到下一条记录}AddToGrid();m_Ado.CloseRecordset();m_Ado.CloseConn();//断开数据库连接// Add ""About..."" menu item to system menu.// IDM_ABOUTBOX must be in the system command range.ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX < 0xF000);CMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != NULL){ CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING IDM_ABOUTBOX strAboutMenu); }}// Set the icon for this dialog. The framework does this automatically// when the application's main window is not a dialogSetIcon(m_hIcon TRUE); // Set big iconSetIcon(m_hIcon FALSE); // Set small icon
//m_ctrlChart.Create(""""WS_VISIBLE CRect(0 0 0 0) this 1234) ;
m_ctrlChart.GetAspect().SetView3D(FALSE);
m_ctrlChart1.GetAspect().SetView3D(FALSE);
m_ctrlChart.GetAxis().GetLeft().GetTitle().SetCaption(""数值"");
m_ctrlChart1.GetAxis().GetLeft().GetTitle().SetCaption(""值"");
m_ctrlChart.AddSeries(0);
m_ctrlChart.Series(0).SetVerticalAxis(0);
m_ctrlChart.Series(0).SetHorizontalAxis(1);
m_ctrlChart.Series(0).GetXValues().SetDateTime(true);
m_ctrlChart1.AddSeries(0);
m_ctrlChart.Series(0).SetColor(RGB(005));
m_ctrlChart1.Series(0).SetColor(RGB(0255255));
m_ctrlChart.Series(0).SetName(""ZongFengGuan"");
m_ctrlChart.Series(0).Clear();
m_ctrlChart1.Series(0).Clear();
/////////////////////////////////
m_ctrlChart.AddSeries(1);
m_ctrlChart.Series(1).SetVerticalAxis(0);
m_ctrlChart.Series(1).SetHorizontalAxis(1);
m_ctrlChart.Series(1).GetXValues().SetDateTime(true);
m_ctrlChart1.AddSeries(1);
m_ctrlChart.Series(1).SetColor(RGB(25500));
m_ctrlChart1.Series(1).SetColor(RGB(00255));
m_ctrlChart.Series(1).Clear();m_ctrlChart1.Series(1).Clear();
//m_ctrlChart.GetPage().SetMaxPointsPerPage(100);
//m_ctrlChart1.GetPage().SetMaxPointsPerPage(8000);//横坐标的范围
srand((int)time(0));
char strTime2[25]strTime8[25];
int k=10;
int l=10;
do
{
itoa(kstrTime210);
itoa(lstrTime810);
int dTemper = k+20;
int dTemper1 = rand()%10;
m_ctrlChart.Series(0).AddXY(kdTemperstrTime2RGB(00255));
m_ctrlChart1.Series(0).AddXY(ldTemper1strTime8RGB(00255));
k=k+10;
l=l+10;
}
while(k<100&&l<100);
m_ctrlChart.GetAxis().GetLeft().SetMinMax(0 100);//纵坐标的范围
m_ctrlChart1.GetAxis().GetLeft().SetMinMax(0 10);
}
void CCccDlg::OnButton1()
{
// TODO: Add your control notification handler code herechar o1[12]o2[12]o3[12]o4[12]o5[12]o6[12]o7[12]o8[12]o9[12]o10[12]o11[12]o12[12]o13[12]o14[12]o15[12]o16[12]o17[12]o18[12];GetDlgItem(IDC_EDIT6)->GetWindowText(o112);GetDlgItem(IDC_EDIT7)->GetWindowText(o212);GetDlgItem(IDC_EDIT8)->GetWindowText(o312);GetDlgItem(IDC_EDIT9)->GetWindowText(o412);GetDlgItem(IDC_EDIT10)->GetWindowText(o512);GetDlgItem(IDC_EDIT11)->GetWindowText(o612);GetDlgItem(IDC_EDIT12)->GetWindowText(o712);GetDlgItem(IDC_EDIT13)->GetWindowText(o812);GetDlgItem(IDC_EDIT14)->GetWindowText(o912);GetDlgItem(IDC_EDIT15)->GetWindowText(o1012);GetDlgItem(IDC_EDIT16)->GetWindowText(o1112);GetDlgItem(IDC_EDIT17)->GetWindowText(o1212);GetDlgItem(IDC_EDIT18)->GetWindowText(o1312);GetDlgItem(IDC_EDIT19)->GetWindowText(o1412);GetDlgItem(IDC_EDIT21)->GetWindowText(o1512);GetDlgItem(IDC_EDIT22)->GetWindowText(o1612);GetDlgItem(IDC_EDIT25)->GetWindowText(o1712);GetDlgItem(IDC_EDIT26)->GetWindowText(o1812);a1=atof(o1);//钢水重量Wsta2=atof(o2);//副枪开始测定时的送氧量Oxma3=atof(o3);//从吹炼开始算起的送氧量a4=atof(o4);//极限碳含量a5=atof(o5);//冷却剂的含氧量a6=atof(o6);//冷却剂的冷却能力a7=atof(o7);//αa8=atof(o8);//βa9=atof(o9);//γa10=atof(o10);//δa11=atof(o11);//副枪测定的碳含量a12=atof(o12);//副枪测定的温度a13=atof(o13);//目标温度a14=atof(o14);//目标碳含量a15=atof(o15);//实际动态吹氧量a16=atof(o16);//实际冷却剂加入量a17=atof(o17);//实际终点碳含量a18=atof(o18);//实际终点温度long double OxeRore;Oxe=((a8*a1*log((exp((a11-a4)/a8)-1)/(exp((a14-a4)/a8)-1))*0.1/a7+a2+a5*(a13-a12-a10+a9*a2/a1)/a6))/(1+(a5*a9)/(a6*a1));Rore=-1*(a13-a12-a10*(Oxe-a2)/a1-a10)/a6;CString str1str2;str1.Format(""%.3f""Oxe);str2.Format(""%.3f""Rore);GetDlgItem(IDC_EDIT5)->SetWindowText(str1);GetDlgItem(IDC_EDIT20)->SetWindowText(str2);//计算碳温曲线()long double wct;wc=0;t=0;m_ctrlChart.GetAspect().SetView3D(FALSE);m_ctrlChart1.GetAspect().SetView3D(FALSE); m_ctrlChart.GetAxis().GetLeft().GetTitle().SetCaption(""碳含量/%""); m_ctrlChart1.GetAxis().GetLeft().GetTitle().SetCaption(""温度/℃""); //m_ctrlChart.GetPage().SetMaxPointsPerPage(20);//m_ctrlChart1.GetPage().SetMaxPointsPerPage(20);srand((int)time(0));char strTime3[25]strTime4[25];long double i=100;if (Rore>0){ do { itoa(istrTime310); itoa(istrTime410); wc=a4+a8*log(1+(exp((a11-a4)/a8)-1)*exp(-10*a7*((i+a5*Rore)/a1)/a8)); t=a12+a9*i/a1+a10-a6*Rore; m_ctrlChart.Series(1).AddXY(iwcstrTime3RGB(0100110)); m_ctrlChart1.Series(1).AddXY(itstrTime4RGB(25500)); i=i+100; } while(fabs(wc-a14)<0.0002||fabs(t-a13)<12||i>1400); m_ctrlChart.GetAxis().GetLeft().SetMinMax(0100); m_ctrlChart1.GetAxis().GetLeft().SetMinMax(0100);}else if(Rore<=0){ int j=100; do { itoa(jstrTime310); itoa(jstrTime410); Rore=0; wc=a4+a8*log(1+(exp((a11-a4)/a8)-1)*exp(-10*a7*((j+a5*Rore)/a1)/a8)); t=a12+a9*j/a1+a10-a6*Rore; m_ctrlChart.Series(1).AddXY(jwcstrTime3RGB(02550)); m_ctrlChart1.Series(1).AddXY(jtstrTime4RGB(25500)); j=j+100; } while(fabs(wc-a14)<0.0002||fabs(t-a13)<12||j>1400); m_ctrlChart.GetAxis().GetLeft().SetMinMax(0100); m_ctrlChart1.GetAxis().GetLeft().SetMinMax(0100);}CString str3str4str5;str3.Format(""%.5f""wc);str4.Format(""%.1f""t);str5.Format(""%f""i);GetDlgItem(IDC_EDIT23)->SetWindowText(str3);GetDlgItem(IDC_EDIT24)->SetWindowText(str4);GetDlgItem(IDC_EDIT21)->SetWindowText(str5);
}
怎么在运行的时候 只显示随机数的曲线 我点button1 不显示我想要的series1的曲线
解决方案
http://blog.sina.com.cn/s/blog_65f1bd560100oka2.html
解决方案二:
求大神解答 我可以上传程序,,,只为你能替我解惑,都一个星期了 还是搞不定啊 急