链接上边的
字太多啦,要分开发!
// 利用复选框来选择要显示的趋势;本来有好多个,但是都是一样的做法,就取了前5个的;
哦,对了这个要放在“复选框”的“事件”的“输入输出域”的“选择框”上的“更改”;
上边的太绕口啦、、“复选框”→“事件→“输入输出域”→“选择框”→“更改,嗯,感觉好多啦!
{
int index=1;
DWORD i;
int CurveNum=16;
SetTagDWord("Intex_2", value);
for (index=1;index{
switch (index)
{
case 1:
if ( value&1)
{
SetPropWord(lpszPictureName,"Control100","Index",0);
SetPropChar(lpszPictureName,"Control100","Name"," 1_HaoWangDaiLu_PV\\PV_1");
}
break;
case 2:
if ( value&2)
{
SetPropWord(lpszPictureName,"Control100","Index",1);
SetPropChar(lpszPictureName,"Control100","Name"," 1_HaoWangDaiLu_PV\\PV_2");
}
break;
case 3:
if ( value&4)
{
SetPropWord(lpszPictureName,"Control100","Index",2);
SetPropChar(lpszPictureName,"Control100","Name"," 1_HaoWangDaiLu_PV\\PV_3");
}
break;
case 4:
if ( value&8)
{
SetPropWord(lpszPictureName,"Control100","Index",3);
SetPropChar(lpszPictureName,"Control100","Name"," 1_HaoWangDaiLu_PV\\PV_4");
}
break;
case 5:
if ( value&16)
{
SetPropWord(lpszPictureName,"Control100","Index",4);
SetPropChar(lpszPictureName,"Control100","Name"," 1_HaoWangDaiLu_PV\\PV_5");
}
break;
}
break;
SetPropChar(lpszPictureName,"Control100","Command","Reload");
}
}
}
这个是在网上看到的比较好玩的C代码,一起付上啦,作者不要建议啊;
//PIC_Name 曲线控件画面名称
//CON_Name 曲线控件名称
//TagIref 曲线1归档变量路径
//++++
SetPropWord(PIC_Name,CON_Name,"Index",0);
SetPropChar(PIC_Name,CON_Name,"TagName",TagIref );
SetPropWord(PIC_Name,CON_Name,"Index",1);
SetPropChar(PIC_Name,CON_Name,"TagName",TagIps);
SetPropWord(PIC_Name,CON_Name,"Index",2);
SetPropChar(PIC_Name,CON_Name,"TagName", TagIpn);
SetPropWord(PIC_Name,CON_Name,"Index",3);
SetPropChar(PIC_Name,CON_Name,"TagName",TagUps);
SetPropWord(PIC_Name,CON_Name,"Index",4);
SetPropChar(PIC_Name,CON_Name,"TagName", TagUpn);
SetPropWord(PIC_Name,CON_Name,"Index",5);
SetPropChar(PIC_Name,CON_Name,"TagName",TagRps);
SetPropWord(PIC_Name,CON_Name,"Index",6);
SetPropChar(PIC_Name,CON_Name,"TagName",TagRpn);
SetPropWord(PIC_Name,CON_Name,"Index",7);
SetPropChar(PIC_Name,CON_Name,"TagName",TagLOAD);
SetPropChar(PIC_Name,CON_Name,"Command","Reload");
}
封装的一个函数,一个趋势图7条线!
#include "apdefap.h"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y)
{
SETUP_TlgOnlineTrend("S0曲线查询.PDL","控件1","1\\11#显示.Iref[A1]","1\\11#显示.Ips[A1]","1\\11#显示.Ipn[A1]","1\\11#显示.Ups[A1]","1\\11#显示.Upn[A1]","1\\11#显示.Rps[A1]","1\\11#显示.Rpn[A1]","1\\11#显示.LOAD[A1]"); //Return-Type: void
// 这个是模板的,就是加上了位置,因为模板比较多,屏幕较大,老是在一个位置显示不好看,是不是,就
先将按钮的位置读上来再写到模板的X,Y上去,搞定!
long x;
long y;
BOOL z;
int a;
x = GetLeft (lpszPictureName,"×é59");
y = GetTop(lpszPictureName,"×é59");
SetTagWord ("Template_X" ,( x - 85)); //?-??????
SetTagWord ("Template_Y" , (y+27));
SetTagChar ("Name" ," 1#加热模板控制");
SetPropChar(lpszPictureName, "画面窗口1","Tagprefix","AOI-00301."); //Return-Type: BOOL AOI-00301.MPI_MAN
SetPictureName(lpszPictureName,"画面窗口1","加热控制模板.PDL");
SetVisible(lpszPictureName, "画面窗口1", 1 ); //??ê??-?? |