说明书百度文库:https://wenku.baidu.com/view/b3f38dbefd0a79563c1e7230.html
内容一:
全球1000多家企业所使用的ActiveX/VCL工控仪表控件
源自内容:https://www.evget.com/product/1489/
内容二:
iocomp是一个强大的工业控件。适用于vb/vc/vs.NET/Delphi/BCB(windows/Linux).囊括了常见的工业控制控件,详见官网说明,源代码可以到官网下载,也可以到我的资源库下载:Iocomp.Full Source.v4.02.SP2.7z,GettingStarted_iocomp手册.rar。
iplot控件安装好了如图示:
结合前面的博文:cport串口控件的应用,本例使用简单iocomp控件中的一个简单iplot控件,实现接收串口数据并显示曲线。
将控件iplot拖进窗体。可以点右键/Edit设置常见的属性。本例演示将只设置标题为空,并添加4路chanel。如图:
接下来在串口接收事件中,画出曲线即可。使用函数:AddXY(double x,double y);十分方便!!!
void __fastcall TForm1::comptRxChar(TObject *Sender, int Count)
{
AnsiString Str;
int y=0;
compt->ReadStr(Str,Count);
memo_1->Text=memo_1->Text+Str;
y=StrToInt(Str);
for(int i=0;;i++)
{
iPlot1->Channel[0]->AddXY(i,y);
}
}
内容三:
写在前面:
本次实验的工作环境:WIN7 64为旗舰版 VS2013 Iocomp ActiveX 402SP1(所以对应的源码文件就是就VisualCppMFCWrappersV4SP1)
1、 新建一个基于MFC的对话框项目,命名为plot曲线绘制,并将两个按钮和一个文本框删掉,建好的项目如下图
2、在对话框的空白处右键-插入ActiveX控件-选择iPlotX Control
3、调整iPlotX Control控件的大小及其布局
4、关联控件变量,变量类型为CiPlotX,改成这个类型是因为为官方提供的源代码中的类就是这么命名的!当然你也可以更改源文件中类的名字,总之,只要这两个对应起来即可
5、删除掉自动产生的两个文件
6、将官方提供的源代码中以IPLOT开头的源文件和头文件以及font.cpp、font.h、picture.cpp、picture.h复制到工程里面,并添加进来(并不是所有的文件都能用到,这个地方为了省事就一起复制进来了)
7、在 plot曲线绘制Dlg.cpp文件中添加两个头文件(因为要用到里面声明的几个函数)和额外的初始化代码
8、添加定时器消息响应函数
9、编译出错,将这个包含文件的1去掉,也就是改成
#include "iplotx.h"
10、编译成功,运行结果如下
附:源码文件包的下载地址
http://www.iocomp.com/Downloads/VisualCPPMFCWrappers.aspx
转:https://blog.csdn.net/wwwlyj123321/article/details/78896975
内容四:
十步会用IOCOMP–iplotx控件
1、 新建项目-MFC-基于对话框
2、 插入ActiveX控件-选择iPlotX Control
3、右击该控件,添加变量,输入变量名
4、类向导-(Dlg结尾那个类)添加函数-IplotxInit(用于该控件基本参数设置)
5、在Dlg.cpp中开头处添加以下代码:
#import "iPlotLibrary.tlb" named_guids
#include "atlbase.h"
using namespace iPlotLibrary;
CComPtr<iPlotLibrary::IiPlotX> PlotComponent;
6、在函数IplotxInit()中添加以下代码:
CWnd* pPlotWnd = GetDlgItem(IDC_IPLOTX1);
IUnknown* m_iUnknown;
//Get iDispatch Inteface to Plot Component
m_iUnknown = pPlotWnd->GetControlUnknown();
m_iUnknown->QueryInterface(__uuidof(iPlotLibrary::IiPlotX), (LPVOID*)&PlotComponent);
//Setup Channels
PlotComponent->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、类向导-添加消息处理函数OnTimer();
8、在OnInitDialog()函数return TRUE前添加以下代码:
IplotxInit();
SetTimer(1, 10, NULL);
9、在函数OnTimer();中添加以下函数:
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