十步会用IOCOMP–iplotx控件
生活随笔
收集整理的這篇文章主要介紹了
十步会用IOCOMP–iplotx控件
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
十步會用IOCOMP–iplotx控件
1、 新建項目-MFC-基于對話框
2、 插入ActiveX控件-選擇iPlotX Control
3、右擊該控件,添加變量,輸入變量名
4、類向導-(Dlg結尾那個類)添加函數(shù)-IplotxInit(用于該控件基本參數(shù)設置)
5、在Dlg.cpp中開頭處添加以下代碼:
6、在函數(shù)IplotxInit()中添加以下代碼:
CWnd* pPlotWnd = GetDlgItem(IDC_IPLOTX1);IUnknown* m_iUnknown;//Get iDispatch Inteface to Plot Componentm_iUnknown = pPlotWnd->GetControlUnknown();m_iUnknown->QueryInterface(__uuidof(iPlotLibrary::IiPlotX), (LPVOID*)&PlotComponent);//Setup ChannelsPlotComponent->RemoveAllChannels();PlotComponent->AddChannel();PlotComponent->AddChannel();PlotComponent->AddChannel();PlotComponent->AddChannel();PlotComponent->AddChannel();PlotComponent->AddChannel();PlotComponent->XAxis[0]->Span = 5;PlotComponent->Labels[0]->Caption = "曲線圖";PlotComponent->GetChannel(0)->TitleText = "曲線1";PlotComponent->GetChannel(1)->TitleText = "曲線2";PlotComponent->GetChannel(2)->TitleText = "曲線3";PlotComponent->GetChannel(3)->TitleText = "曲線4";PlotComponent->GetChannel(4)->TitleText = "曲線5";PlotComponent->GetChannel(5)->TitleText = "曲線6";7、類向導-添加消息處理函數(shù)OnTimer();
8、在OnInitDialog()函數(shù)return TRUE前添加以下代碼:
9、在函數(shù)OnTimer();中添加以下函數(shù):
static float i = 10;PlotComponent->GetChannel(0)->AddYElapsedSeconds(40*sin(0.01*i));//AddYNow((int)i);PlotComponent->GetChannel(1)->AddYElapsedSeconds(40 * cos(0.01*i));//AddYNow((int)i);PlotComponent->GetChannel(2)->AddYElapsedSeconds(40 * sin(0.01*i + 1));//AddYNow((int)i);PlotComponent->GetChannel(3)->AddYElapsedSeconds(40 * cos(0.01*i + 1));//AddYNow((int)i);PlotComponent->GetChannel(4)->AddYElapsedSeconds(40 * sin(0.01*i + 2));PlotComponent->GetChannel(5)->AddYElapsedSeconds(40 * cos(0.01*i + 2));i++;i++;i++;10、按F5鍵。
效果圖:
源碼下載:http://download.csdn.net/detail/cracent/9794944
總結
以上是生活随笔為你收集整理的十步会用IOCOMP–iplotx控件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 安卓机用什么无线蓝牙耳机好?适合安卓机的
- 下一篇: 使用tesserocr二值化识别知网登录