程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> 動態-vc++6.0 中teechart不懂之處

動態-vc++6.0 中teechart不懂之處

編輯:編程綜合問答
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_EDIT1,strDate);
SetDlgItemText(IDC_EDIT2,strTime);
SetTimer(1,1000,NULL);//計置計時器

m_Grid1.SetExtendedStyle(LVS_EX_FLATSB
    |LVS_EX_FULLROWSELECT
    |LVS_EX_HEADERDRAGDROP
    |LVS_EX_ONECLICKACTIVATE
    |LVS_EX_GRIDLINES);
m_Grid1.InsertColumn(0,"日期",LVCFMT_LEFT,130,0);
m_Grid1.InsertColumn(1,"時間",LVCFMT_LEFT,130,1);
m_Grid1.InsertColumn(2,"爐號",LVCFMT_LEFT,130,2); 
m_Grid1.InsertColumn(3,"鋼種",LVCFMT_LEFT,130,3);
m_Grid1.InsertColumn(4,"班組",LVCFMT_LEFT,130,4);
m_Grid1.InsertColumn(5,"爐齡",LVCFMT_LEFT,130,5);

m_Grid1.InsertColumn(6,"計算動態吹氧量",LVCFMT_LEFT,130,6);
m_Grid1.InsertColumn(7,"計算冷卻劑加入量",LVCFMT_LEFT,130,7);
m_Grid1.InsertColumn(8,"鋼水碳含量推定值",LVCFMT_LEFT,130,8);
m_Grid1.InsertColumn(9,"鋼水溫度推定值",LVCFMT_LEFT,130,9);

m_Grid1.InsertColumn(10,"實際動態吹氧量",LVCFMT_LEFT,130,10);
m_Grid1.InsertColumn(11,"實際冷卻劑加入量",LVCFMT_LEFT,130,11);
m_Grid1.InsertColumn(12,"實際終點碳含量",LVCFMT_LEFT,130,12);
m_Grid1.InsertColumn(13,"實際終點鋼水溫度",LVCFMT_LEFT,130,13);

m_Grid1.InsertColumn(14,"脫碳系數α",LVCFMT_LEFT,130,14);
m_Grid1.InsertColumn(15,"脫碳系數β",LVCFMT_LEFT,130,15);
m_Grid1.InsertColumn(16,"升溫系數γ",LVCFMT_LEFT,130,16);
m_Grid1.InsertColumn(17,"升溫系數δ",LVCFMT_LEFT,130,17);


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(0,0,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("日期"));
    m_Grid1.SetItemText(0,1,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("時間"));
    m_Grid1.SetItemText(0,2,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("爐號"));      
    m_Grid1.SetItemText(0,3,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("鋼種"));
    m_Grid1.SetItemText(0,4,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("班組"));
    m_Grid1.SetItemText(0,5,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("爐齡"));

    m_Grid1.SetItemText(0,6,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("計算動態吹氧量"));
    m_Grid1.SetItemText(0,7,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("計算冷卻劑加入量"));
    m_Grid1.SetItemText(0,8,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("鋼水碳含量推定值"));
    m_Grid1.SetItemText(0,9,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("鋼水溫度推定值"));

    m_Grid1.SetItemText(0,10,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("實際動態吹氧量"));
    m_Grid1.SetItemText(0,11,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("實際冷卻劑加入量"));
    m_Grid1.SetItemText(0,12,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("實際終點碳含量"));
    m_Grid1.SetItemText(0,13,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("實際終點鋼水溫度"));

    m_Grid1.SetItemText(0,14,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("脫碳系數α"));
    m_Grid1.SetItemText(0,15,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("脫碳系數β"));
    m_Grid1.SetItemText(0,16,(char*)(_bstr_t)m_Ado.m_pRecordset->GetCollect("升溫系數γ"));
    m_Grid1.SetItemText(0,17,(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 dialog
SetIcon(m_hIcon, TRUE);         // Set big icon
SetIcon(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(0,0,5));
m_ctrlChart1.Series(0).SetColor(RGB(0,255,255));
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(255,0,0));
m_ctrlChart1.Series(1).SetColor(RGB(0,0,255));
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(k,strTime2,10);
itoa(l,strTime8,10);
int dTemper = k+20;
int dTemper1 = rand()%10;
m_ctrlChart.Series(0).AddXY(k,dTemper,strTime2,RGB(0,0,255));
m_ctrlChart1.Series(0).AddXY(l,dTemper1,strTime8,RGB(0,0,255));
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 here

char 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(o1,12);
GetDlgItem(IDC_EDIT7)->GetWindowText(o2,12);
GetDlgItem(IDC_EDIT8)->GetWindowText(o3,12);
GetDlgItem(IDC_EDIT9)->GetWindowText(o4,12);
GetDlgItem(IDC_EDIT10)->GetWindowText(o5,12);
GetDlgItem(IDC_EDIT11)->GetWindowText(o6,12);
GetDlgItem(IDC_EDIT12)->GetWindowText(o7,12);
GetDlgItem(IDC_EDIT13)->GetWindowText(o8,12);
GetDlgItem(IDC_EDIT14)->GetWindowText(o9,12);
GetDlgItem(IDC_EDIT15)->GetWindowText(o10,12);
GetDlgItem(IDC_EDIT16)->GetWindowText(o11,12);
GetDlgItem(IDC_EDIT17)->GetWindowText(o12,12);
GetDlgItem(IDC_EDIT18)->GetWindowText(o13,12);
GetDlgItem(IDC_EDIT19)->GetWindowText(o14,12);
GetDlgItem(IDC_EDIT21)->GetWindowText(o15,12);
GetDlgItem(IDC_EDIT22)->GetWindowText(o16,12);
GetDlgItem(IDC_EDIT25)->GetWindowText(o17,12);
GetDlgItem(IDC_EDIT26)->GetWindowText(o18,12);

a1=atof(o1);//鋼水重量Wst
a2=atof(o2);//副槍開始測定時的送氧量Oxm
a3=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 Oxe,Rore;
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 str1,str2;
str1.Format("%.3f",Oxe);
str2.Format("%.3f",Rore);
GetDlgItem(IDC_EDIT5)->SetWindowText(str1);
GetDlgItem(IDC_EDIT20)->SetWindowText(str2);
//計算碳溫曲線()
long double wc,t;
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(i,strTime3,10);
    itoa(i,strTime4,10);
    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(i,wc,strTime3,RGB(0,100,110));
    m_ctrlChart1.Series(1).AddXY(i,t,strTime4,RGB(255,0,0));
    i=i+100;
    }
    while(fabs(wc-a14)<0.0002||fabs(t-a13)<12||i>1400);
    m_ctrlChart.GetAxis().GetLeft().SetMinMax(0,100);
    m_ctrlChart1.GetAxis().GetLeft().SetMinMax(0,100);
}
else if(Rore<=0)
{
    int j=100;
    do
    {
    itoa(j,strTime3,10);
    itoa(j,strTime4,10);
    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(j,wc,strTime3,RGB(0,255,0));
    m_ctrlChart1.Series(1).AddXY(j,t,strTime4,RGB(255,0,0));
    j=j+100;
    }
    while(fabs(wc-a14)<0.0002||fabs(t-a13)<12||j>1400);
    m_ctrlChart.GetAxis().GetLeft().SetMinMax(0,100);
    m_ctrlChart1.GetAxis().GetLeft().SetMinMax(0,100);
}
CString str3,str4,str5;
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

qq_23935107
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved